diff options
Diffstat (limited to 'src')
26 files changed, 211 insertions, 52 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 6ffc612e7..d1ec8ff08 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -172,5 +172,5 @@ endif() create_target_directory_groups(common) -target_link_libraries(common PUBLIC Boost::boost fmt microprofile) -target_link_libraries(common PRIVATE lz4_static libzstd_static) +target_link_libraries(common PUBLIC Boost::boost fmt::fmt microprofile) +target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 8546d3602..47418006b 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -606,11 +606,11 @@ endif() create_target_directory_groups(core) target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) -target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt json-headers mbedtls opus unicorn) +target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus unicorn) if (YUZU_ENABLE_BOXCAT) target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT) - target_link_libraries(core PRIVATE httplib json-headers zip) + target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json zip) endif() if (ENABLE_WEB_SERVICE) diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 5febe8fc1..d29e78d7e 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -4,8 +4,8 @@ #include <fmt/ostream.h> #include <httplib.h> -#include <json.hpp> #include <mbedtls/sha256.h> +#include <nlohmann/json.hpp> #include "common/hex_util.h" #include "common/logging/backend.h" #include "common/logging/log.h" diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5559587e3..c84cb1483 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -157,7 +157,7 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) { {11, &Hid::ActivateTouchScreen, "ActivateTouchScreen"}, {21, &Hid::ActivateMouse, "ActivateMouse"}, {31, &Hid::ActivateKeyboard, "ActivateKeyboard"}, - {32, nullptr, "SendKeyboardLockKeyEvent"}, + {32, &Hid::SendKeyboardLockKeyEvent, "SendKeyboardLockKeyEvent"}, {40, nullptr, "AcquireXpadIdEventHandle"}, {41, nullptr, "ReleaseXpadIdEventHandle"}, {51, &Hid::ActivateXpad, "ActivateXpad"}, @@ -871,6 +871,15 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); } +void Hid::SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto flags{rp.Pop<u32>()}; + LOG_WARNING(Service_HID, "(STUBBED) called. flags={}", flags); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + class HidDbg final : public ServiceFramework<HidDbg> { public: explicit HidDbg() : ServiceFramework{"hid:dbg"} { diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 23552efb1..c8ed4ad8b 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -130,6 +130,7 @@ private: void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); void StopSevenSixAxisSensor(Kernel::HLERequestContext& ctx); void InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); + void SendKeyboardLockKeyEvent(Kernel::HLERequestContext& ctx); std::shared_ptr<IAppletResource> applet_resource; Core::System& system; diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 558cbe6d7..76cfa5a17 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp @@ -4,11 +4,12 @@ #include <ctime> #include <fstream> +#include <iomanip> #include <fmt/chrono.h> #include <fmt/format.h> #include <fmt/ostream.h> -#include <json.hpp> +#include <nlohmann/json.hpp> #include "common/file_util.h" #include "common/hex_util.h" diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 33936e209..024c9e43b 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -44,6 +44,12 @@ void Maxwell3D::InitializeRegisterDefaults() { viewport.depth_range_near = 0.0f; viewport.depth_range_far = 1.0f; } + for (auto& viewport : regs.viewport_transform) { + viewport.swizzle.x.Assign(Regs::ViewportSwizzle::PositiveX); + viewport.swizzle.y.Assign(Regs::ViewportSwizzle::PositiveY); + viewport.swizzle.z.Assign(Regs::ViewportSwizzle::PositiveZ); + viewport.swizzle.w.Assign(Regs::ViewportSwizzle::PositiveW); + } // Doom and Bomberman seems to use the uninitialized registers and just enable blend // so initialize blend registers with sane values diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 1a5df05ce..05dd6b39b 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -576,6 +576,17 @@ public: Replay = 3, }; + enum class ViewportSwizzle : u32 { + PositiveX = 0, + NegativeX = 1, + PositiveY = 2, + NegativeY = 3, + PositiveZ = 4, + NegativeZ = 5, + PositiveW = 6, + NegativeW = 7, + }; + struct RenderTargetConfig { u32 address_high; u32 address_low; @@ -619,7 +630,14 @@ public: f32 translate_x; f32 translate_y; f32 translate_z; - INSERT_UNION_PADDING_WORDS(2); + union { + u32 raw; + BitField<0, 3, ViewportSwizzle> x; + BitField<4, 3, ViewportSwizzle> y; + BitField<8, 3, ViewportSwizzle> z; + BitField<12, 3, ViewportSwizzle> w; + } swizzle; + INSERT_UNION_PADDING_WORDS(1); Common::Rectangle<f32> GetRect() const { return { diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index dd51c95b7..a1b4c305c 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -68,6 +68,7 @@ enum class RenderTargetFormat : u32 { BGR5A1_UNORM = 0xE9, RG8_UNORM = 0xEA, RG8_SNORM = 0xEB, + RG8_UINT = 0xED, R16_UNORM = 0xEE, R16_SNORM = 0xEF, R16_SINT = 0xF0, diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index 6d522c318..836b25c1d 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp @@ -83,6 +83,7 @@ static constexpr ConversionArray morton_to_linear_fns = { MortonCopy<true, PixelFormat::RGBA8_SRGB>, MortonCopy<true, PixelFormat::RG8U>, MortonCopy<true, PixelFormat::RG8S>, + MortonCopy<true, PixelFormat::RG8UI>, MortonCopy<true, PixelFormat::RG32UI>, MortonCopy<true, PixelFormat::RGBX16F>, MortonCopy<true, PixelFormat::R32UI>, @@ -166,6 +167,7 @@ static constexpr ConversionArray linear_to_morton_fns = { MortonCopy<false, PixelFormat::RGBA8_SRGB>, MortonCopy<false, PixelFormat::RG8U>, MortonCopy<false, PixelFormat::RG8S>, + MortonCopy<false, PixelFormat::RG8UI>, MortonCopy<false, PixelFormat::RG32UI>, MortonCopy<false, PixelFormat::RGBX16F>, MortonCopy<false, PixelFormat::R32UI>, diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 8b3b3ce92..69dcf952f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1019,6 +1019,14 @@ void RasterizerOpenGL::SyncViewport() { const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z; const GLdouble far_depth = src.translate_z + src.scale_z; glDepthRangeIndexed(static_cast<GLuint>(i), near_depth, far_depth); + + if (!GLAD_GL_NV_viewport_swizzle) { + continue; + } + glViewportSwizzleNV(static_cast<GLuint>(i), MaxwellToGL::ViewportSwizzle(src.swizzle.x), + MaxwellToGL::ViewportSwizzle(src.swizzle.y), + MaxwellToGL::ViewportSwizzle(src.swizzle.z), + MaxwellToGL::ViewportSwizzle(src.swizzle.w)); } } } diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 2729d1265..94fbd2a22 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -83,6 +83,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, // RGBA8_SRGB {GL_RG8, GL_RG, GL_UNSIGNED_BYTE}, // RG8U {GL_RG8_SNORM, GL_RG, GL_BYTE}, // RG8S + {GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG8UI {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT}, // RG32UI {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT}, // RGBX16F {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT}, // R32UI diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 2c0c77c28..994ae98eb 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -503,5 +503,10 @@ inline GLenum PolygonMode(Maxwell::PolygonMode polygon_mode) { return GL_FILL; } +inline GLenum ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) { + // Enumeration order matches register order. We can convert it arithmetically. + return GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV + static_cast<GLenum>(swizzle); +} + } // namespace MaxwellToGL } // namespace OpenGL diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp index 648b1e71b..568744e3c 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <algorithm> #include <cstring> #include <tuple> @@ -92,6 +93,7 @@ void FixedPipelineState::Rasterizer::Fill(const Maxwell& regs) noexcept { tessellation_clockwise.Assign(regs.tess_mode.cw.Value()); logic_op_enable.Assign(regs.logic_op.enable != 0 ? 1 : 0); logic_op.Assign(PackLogicOp(regs.logic_op.operation)); + rasterize_enable.Assign(regs.rasterize_enable != 0 ? 1 : 0); std::memcpy(&point_size, ®s.point_size, sizeof(point_size)); // TODO: C++20 std::bit_cast } @@ -101,6 +103,12 @@ void FixedPipelineState::ColorBlending::Fill(const Maxwell& regs) noexcept { } } +void FixedPipelineState::ViewportSwizzles::Fill(const Maxwell& regs) noexcept { + const auto& transform = regs.viewport_transform; + std::transform(transform.begin(), transform.end(), swizzles.begin(), + [](const auto& viewport) { return static_cast<u16>(viewport.swizzle.raw); }); +} + void FixedPipelineState::BlendingAttachment::Fill(const Maxwell& regs, std::size_t index) { const auto& mask = regs.color_mask[regs.color_mask_common ? 0 : index]; @@ -144,6 +152,7 @@ void FixedPipelineState::Fill(const Maxwell& regs) { rasterizer.Fill(regs); depth_stencil.Fill(regs); color_blending.Fill(regs); + viewport_swizzles.Fill(regs); } std::size_t FixedPipelineState::Hash() const noexcept { diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h index 8652067a7..31a6398f2 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h @@ -164,6 +164,7 @@ struct FixedPipelineState { BitField<23, 1, u32> tessellation_clockwise; BitField<24, 1, u32> logic_op_enable; BitField<25, 4, u32> logic_op; + BitField<29, 1, u32> rasterize_enable; }; // TODO(Rodrigo): Move this to push constants @@ -233,10 +234,17 @@ struct FixedPipelineState { void Fill(const Maxwell& regs) noexcept; }; + struct ViewportSwizzles { + std::array<u16, Maxwell::NumViewports> swizzles; + + void Fill(const Maxwell& regs) noexcept; + }; + VertexInput vertex_input; Rasterizer rasterizer; DepthStencil depth_stencil; ColorBlending color_blending; + ViewportSwizzles viewport_swizzles; void Fill(const Maxwell& regs); diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 8681b821f..12be691a5 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp @@ -160,6 +160,7 @@ struct FormatTuple { {VK_FORMAT_R8G8B8A8_SRGB, Attachable}, // RGBA8_SRGB {VK_FORMAT_R8G8_UNORM, Attachable | Storage}, // RG8U {VK_FORMAT_R8G8_SNORM, Attachable | Storage}, // RG8S + {VK_FORMAT_R8G8_UINT, Attachable | Storage}, // RG8UI {VK_FORMAT_R32G32_UINT, Attachable | Storage}, // RG32UI {VK_FORMAT_UNDEFINED}, // RGBX16F {VK_FORMAT_R32_UINT, Attachable | Storage}, // R32UI @@ -345,8 +346,6 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib break; case Maxwell::VertexAttribute::Type::SignedInt: switch (size) { - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - return VK_FORMAT_R16G16B16A16_SINT; case Maxwell::VertexAttribute::Size::Size_8: return VK_FORMAT_R8_SINT; case Maxwell::VertexAttribute::Size::Size_8_8: @@ -355,8 +354,22 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib return VK_FORMAT_R8G8B8_SINT; case Maxwell::VertexAttribute::Size::Size_8_8_8_8: return VK_FORMAT_R8G8B8A8_SINT; + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_SINT; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_SINT; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_SINT; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_SINT; case Maxwell::VertexAttribute::Size::Size_32: return VK_FORMAT_R32_SINT; + case Maxwell::VertexAttribute::Size::Size_32_32: + return VK_FORMAT_R32G32_SINT; + case Maxwell::VertexAttribute::Size::Size_32_32_32: + return VK_FORMAT_R32G32B32_SINT; + case Maxwell::VertexAttribute::Size::Size_32_32_32_32: + return VK_FORMAT_R32G32B32A32_SINT; default: break; } @@ -672,4 +685,27 @@ VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle) { return {}; } +VkViewportCoordinateSwizzleNV ViewportSwizzle(Maxwell::ViewportSwizzle swizzle) { + switch (swizzle) { + case Maxwell::ViewportSwizzle::PositiveX: + return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV; + case Maxwell::ViewportSwizzle::NegativeX: + return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV; + case Maxwell::ViewportSwizzle::PositiveY: + return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV; + case Maxwell::ViewportSwizzle::NegativeY: + return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV; + case Maxwell::ViewportSwizzle::PositiveZ: + return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV; + case Maxwell::ViewportSwizzle::NegativeZ: + return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV; + case Maxwell::ViewportSwizzle::PositiveW: + return VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV; + case Maxwell::ViewportSwizzle::NegativeW: + return VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV; + } + UNREACHABLE_MSG("Invalid swizzle={}", static_cast<int>(swizzle)); + return {}; +} + } // namespace Vulkan::MaxwellToVK diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.h b/src/video_core/renderer_vulkan/maxwell_to_vk.h index 81bce4c6c..7e213452f 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.h +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.h @@ -59,4 +59,6 @@ VkCullModeFlags CullFace(Maxwell::CullFace cull_face); VkComponentSwizzle SwizzleSource(Tegra::Texture::SwizzleSource swizzle); +VkViewportCoordinateSwizzleNV ViewportSwizzle(Maxwell::ViewportSwizzle swizzle); + } // namespace Vulkan::MaxwellToVK diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp index 09ddfa59c..f0c491d00 100644 --- a/src/video_core/renderer_vulkan/vk_device.cpp +++ b/src/video_core/renderer_vulkan/vk_device.cpp @@ -94,6 +94,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties( VK_FORMAT_R8G8B8A8_SRGB, VK_FORMAT_R8G8_UNORM, VK_FORMAT_R8G8_SNORM, + VK_FORMAT_R8G8_UINT, VK_FORMAT_R8_UNORM, VK_FORMAT_R8_UINT, VK_FORMAT_B10G11R11_UFLOAT_PACK32, @@ -260,6 +261,10 @@ bool VKDevice::Create() { LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively"); } + if (!nv_viewport_swizzle) { + LOG_INFO(Render_Vulkan, "Device doesn't support viewport swizzles"); + } + VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR std430_layout; if (khr_uniform_buffer_standard_layout) { std430_layout.sType = @@ -533,6 +538,7 @@ std::vector<const char*> VKDevice::LoadExtensions() { bool has_ext_transform_feedback{}; bool has_ext_custom_border_color{}; for (const auto& extension : physical.EnumerateDeviceExtensionProperties()) { + Test(extension, nv_viewport_swizzle, VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME, true); Test(extension, khr_uniform_buffer_standard_layout, VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME, true); Test(extension, has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, diff --git a/src/video_core/renderer_vulkan/vk_device.h b/src/video_core/renderer_vulkan/vk_device.h index ccdf82754..6b9227b09 100644 --- a/src/video_core/renderer_vulkan/vk_device.h +++ b/src/video_core/renderer_vulkan/vk_device.h @@ -147,6 +147,11 @@ public: return is_formatless_image_load_supported; } + /// Returns true if the device supports VK_NV_viewport_swizzle. + bool IsNvViewportSwizzleSupported() const { + return nv_viewport_swizzle; + } + /// Returns true if the device supports VK_EXT_scalar_block_layout. bool IsKhrUniformBufferStandardLayoutSupported() const { return khr_uniform_buffer_standard_layout; @@ -227,6 +232,7 @@ private: bool is_float16_supported{}; ///< Support for float16 arithmetics. bool is_warp_potentially_bigger{}; ///< Host warp size can be bigger than guest. bool is_formatless_image_load_supported{}; ///< Support for shader image read without format. + bool nv_viewport_swizzle{}; ///< Support for VK_NV_viewport_swizzle. bool khr_uniform_buffer_standard_layout{}; ///< Support for std430 on UBOs. bool ext_index_type_uint8{}; ///< Support for VK_EXT_index_type_uint8. bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted. diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 1ac981974..69b6bba00 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <algorithm> #include <array> #include <cstring> #include <vector> @@ -50,6 +51,23 @@ bool SupportsPrimitiveRestart(VkPrimitiveTopology topology) { topology) == std::end(unsupported_topologies); } +VkViewportSwizzleNV UnpackViewportSwizzle(u16 swizzle) { + union { + u32 raw; + BitField<0, 3, Maxwell::ViewportSwizzle> x; + BitField<4, 3, Maxwell::ViewportSwizzle> y; + BitField<8, 3, Maxwell::ViewportSwizzle> z; + BitField<12, 3, Maxwell::ViewportSwizzle> w; + } const unpacked{swizzle}; + + VkViewportSwizzleNV result; + result.x = MaxwellToVK::ViewportSwizzle(unpacked.x); + result.y = MaxwellToVK::ViewportSwizzle(unpacked.y); + result.z = MaxwellToVK::ViewportSwizzle(unpacked.z); + result.w = MaxwellToVK::ViewportSwizzle(unpacked.w); + return result; +} + } // Anonymous namespace VKGraphicsPipeline::VKGraphicsPipeline(const VKDevice& device, VKScheduler& scheduler, @@ -162,6 +180,7 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa const auto& ds = fixed_state.depth_stencil; const auto& cd = fixed_state.color_blending; const auto& rs = fixed_state.rasterizer; + const auto& viewport_swizzles = fixed_state.viewport_swizzles.swizzles; std::vector<VkVertexInputBindingDescription> vertex_bindings; std::vector<VkVertexInputBindingDivisorDescriptionEXT> vertex_binding_divisors; @@ -244,12 +263,25 @@ vk::Pipeline VKGraphicsPipeline::CreatePipeline(const RenderPassParams& renderpa viewport_ci.scissorCount = Maxwell::NumViewports; viewport_ci.pScissors = nullptr; + std::array<VkViewportSwizzleNV, Maxwell::NumViewports> swizzles; + std::transform(viewport_swizzles.begin(), viewport_swizzles.end(), swizzles.begin(), + UnpackViewportSwizzle); + VkPipelineViewportSwizzleStateCreateInfoNV swizzle_ci; + swizzle_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV; + swizzle_ci.pNext = nullptr; + swizzle_ci.flags = 0; + swizzle_ci.viewportCount = Maxwell::NumViewports; + swizzle_ci.pViewportSwizzles = swizzles.data(); + if (device.IsNvViewportSwizzleSupported()) { + viewport_ci.pNext = &swizzle_ci; + } + VkPipelineRasterizationStateCreateInfo rasterization_ci; rasterization_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterization_ci.pNext = nullptr; rasterization_ci.flags = 0; rasterization_ci.depthClampEnable = rs.depth_clamp_disabled == 0 ? VK_TRUE : VK_FALSE; - rasterization_ci.rasterizerDiscardEnable = VK_FALSE; + rasterization_ci.rasterizerDiscardEnable = rs.rasterize_enable == 0 ? VK_TRUE : VK_FALSE; rasterization_ci.polygonMode = VK_POLYGON_MODE_FILL; rasterization_ci.cullMode = rs.cull_enable ? MaxwellToVK::CullFace(rs.CullFace()) : VK_CULL_MODE_NONE; diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index cc7181229..bbe93903c 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp @@ -145,6 +145,8 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) return PixelFormat::RG8U; case Tegra::RenderTargetFormat::RG8_SNORM: return PixelFormat::RG8S; + case Tegra::RenderTargetFormat::RG8_UINT: + return PixelFormat::RG8UI; case Tegra::RenderTargetFormat::R16_FLOAT: return PixelFormat::R16F; case Tegra::RenderTargetFormat::R16_UNORM: diff --git a/src/video_core/surface.h b/src/video_core/surface.h index e0acd44d3..6da6a1b97 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h @@ -57,51 +57,52 @@ enum class PixelFormat { RGBA8_SRGB = 39, RG8U = 40, RG8S = 41, - RG32UI = 42, - RGBX16F = 43, - R32UI = 44, - R32I = 45, - ASTC_2D_8X8 = 46, - ASTC_2D_8X5 = 47, - ASTC_2D_5X4 = 48, - BGRA8_SRGB = 49, - DXT1_SRGB = 50, - DXT23_SRGB = 51, - DXT45_SRGB = 52, - BC7U_SRGB = 53, - R4G4B4A4U = 54, - ASTC_2D_4X4_SRGB = 55, - ASTC_2D_8X8_SRGB = 56, - ASTC_2D_8X5_SRGB = 57, - ASTC_2D_5X4_SRGB = 58, - ASTC_2D_5X5 = 59, - ASTC_2D_5X5_SRGB = 60, - ASTC_2D_10X8 = 61, - ASTC_2D_10X8_SRGB = 62, - ASTC_2D_6X6 = 63, - ASTC_2D_6X6_SRGB = 64, - ASTC_2D_10X10 = 65, - ASTC_2D_10X10_SRGB = 66, - ASTC_2D_12X12 = 67, - ASTC_2D_12X12_SRGB = 68, - ASTC_2D_8X6 = 69, - ASTC_2D_8X6_SRGB = 70, - ASTC_2D_6X5 = 71, - ASTC_2D_6X5_SRGB = 72, - E5B9G9R9F = 73, + RG8UI = 42, + RG32UI = 43, + RGBX16F = 44, + R32UI = 45, + R32I = 46, + ASTC_2D_8X8 = 47, + ASTC_2D_8X5 = 48, + ASTC_2D_5X4 = 49, + BGRA8_SRGB = 50, + DXT1_SRGB = 51, + DXT23_SRGB = 52, + DXT45_SRGB = 53, + BC7U_SRGB = 54, + R4G4B4A4U = 55, + ASTC_2D_4X4_SRGB = 56, + ASTC_2D_8X8_SRGB = 57, + ASTC_2D_8X5_SRGB = 58, + ASTC_2D_5X4_SRGB = 59, + ASTC_2D_5X5 = 60, + ASTC_2D_5X5_SRGB = 61, + ASTC_2D_10X8 = 62, + ASTC_2D_10X8_SRGB = 63, + ASTC_2D_6X6 = 64, + ASTC_2D_6X6_SRGB = 65, + ASTC_2D_10X10 = 66, + ASTC_2D_10X10_SRGB = 67, + ASTC_2D_12X12 = 68, + ASTC_2D_12X12_SRGB = 69, + ASTC_2D_8X6 = 70, + ASTC_2D_8X6_SRGB = 71, + ASTC_2D_6X5 = 72, + ASTC_2D_6X5_SRGB = 73, + E5B9G9R9F = 74, MaxColorFormat, // Depth formats - Z32F = 74, - Z16 = 75, + Z32F = 75, + Z16 = 76, MaxDepthFormat, // DepthStencil formats - Z24S8 = 76, - S8Z24 = 77, - Z32FS8 = 78, + Z24S8 = 77, + S8Z24 = 78, + Z32FS8 = 79, MaxDepthStencilFormat, @@ -171,6 +172,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{ 0, // RGBA8_SRGB 0, // RG8U 0, // RG8S + 0, // RG8UI 0, // RG32UI 0, // RGBX16F 0, // R32UI @@ -269,6 +271,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ 1, // RGBA8_SRGB 1, // RG8U 1, // RG8S + 1, // RG8UI 1, // RG32UI 1, // RGBX16F 1, // R32UI @@ -359,6 +362,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{ 1, // RGBA8_SRGB 1, // RG8U 1, // RG8S + 1, // RG8UI 1, // RG32UI 1, // RGBX16F 1, // R32UI @@ -449,6 +453,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{ 32, // RGBA8_SRGB 16, // RG8U 16, // RG8S + 16, // RG8UI 64, // RG32UI 64, // RGBX16F 32, // R32UI diff --git a/src/video_core/texture_cache/format_lookup_table.cpp b/src/video_core/texture_cache/format_lookup_table.cpp index 25d2ee2e8..7032e0059 100644 --- a/src/video_core/texture_cache/format_lookup_table.cpp +++ b/src/video_core/texture_cache/format_lookup_table.cpp @@ -41,7 +41,7 @@ struct Table { ComponentType alpha_component; bool is_srgb; }; -constexpr std::array<Table, 76> DefinitionTable = {{ +constexpr std::array<Table, 77> DefinitionTable = {{ {TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U}, {TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S}, {TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI}, @@ -60,6 +60,7 @@ constexpr std::array<Table, 76> DefinitionTable = {{ {TextureFormat::G8R8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RG8U}, {TextureFormat::G8R8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RG8S}, + {TextureFormat::G8R8, C, UINT, UINT, UINT, UINT, PixelFormat::RG8UI}, {TextureFormat::R16_G16_B16_A16, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::RGBA16S}, {TextureFormat::R16_G16_B16_A16, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::RGBA16U}, diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt index 0c9bb0d55..06ab7c59d 100644 --- a/src/web_service/CMakeLists.txt +++ b/src/web_service/CMakeLists.txt @@ -8,4 +8,4 @@ add_library(web_service STATIC ) create_target_directory_groups(web_service) -target_link_libraries(web_service PRIVATE common json-headers httplib lurlparser) +target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib lurlparser) diff --git a/src/web_service/telemetry_json.cpp b/src/web_service/telemetry_json.cpp index 7538389bf..7a480e33c 100644 --- a/src/web_service/telemetry_json.cpp +++ b/src/web_service/telemetry_json.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include <json.hpp> +#include <nlohmann/json.hpp> #include "common/detached_tasks.h" #include "common/web_result.h" #include "web_service/telemetry_json.h" diff --git a/src/web_service/verify_login.cpp b/src/web_service/verify_login.cpp index ca4b43b93..bfaa5b70a 100644 --- a/src/web_service/verify_login.cpp +++ b/src/web_service/verify_login.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include <json.hpp> +#include <nlohmann/json.hpp> #include "common/web_result.h" #include "web_service/verify_login.h" #include "web_service/web_backend.h" |