diff options
Diffstat (limited to 'src/video_core')
6 files changed, 25 insertions, 16 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 1ad56d9e7..ddb70934c 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp @@ -49,7 +49,7 @@ using VideoCommon::LoadPipelines; using VideoCommon::SerializePipeline; using Context = ShaderContext::Context; -constexpr u32 CACHE_VERSION = 5; +constexpr u32 CACHE_VERSION = 6; template <typename Container> auto MakeSpan(Container& container) { diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 8c0fffc67..99cd11d1e 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -93,6 +93,7 @@ GLenum ImageTarget(Shader::TextureType type, int num_samples = 1) { case Shader::TextureType::Color1D: return GL_TEXTURE_1D; case Shader::TextureType::Color2D: + case Shader::TextureType::Color2DRect: return is_multisampled ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D; case Shader::TextureType::ColorCube: return GL_TEXTURE_CUBE_MAP; @@ -502,6 +503,7 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, ProgramManager& set_view(Shader::TextureType::ColorArray1D, null_image_1d_array.handle); set_view(Shader::TextureType::ColorArray2D, null_image_view_2d_array.handle); set_view(Shader::TextureType::ColorArrayCube, null_image_cube_array.handle); + set_view(Shader::TextureType::Color2DRect, null_image_view_2d.handle); if (resolution.active) { for (size_t i = 0; i < rescale_draw_fbos.size(); ++i) { @@ -1110,6 +1112,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI flat_range.extent.layers = 1; [[fallthrough]]; case ImageViewType::e2D: + case ImageViewType::Rect: if (True(flags & VideoCommon::ImageViewFlagBits::Slice)) { // 2D and 2D array views on a 3D textures are used exclusively for render targets ASSERT(info.range.extent.levels == 1); @@ -1135,9 +1138,6 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI SetupView(Shader::TextureType::ColorCube); SetupView(Shader::TextureType::ColorArrayCube); break; - case ImageViewType::Rect: - UNIMPLEMENTED(); - break; case ImageViewType::Buffer: ASSERT(false); break; @@ -1150,6 +1150,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI default_handle = Handle(Shader::TextureType::ColorArray1D); break; case ImageViewType::e2D: + case ImageViewType::Rect: default_handle = Handle(Shader::TextureType::Color2D); break; case ImageViewType::e2DArray: @@ -1210,6 +1211,7 @@ GLuint ImageView::MakeView(Shader::TextureType view_type, GLenum view_format) { case Shader::TextureType::Color1D: case Shader::TextureType::Color2D: case Shader::TextureType::ColorCube: + case Shader::TextureType::Color2DRect: view_range = flat_range; break; case Shader::TextureType::ColorArray1D: @@ -1250,7 +1252,6 @@ Sampler::Sampler(TextureCacheRuntime& runtime, const TSCEntry& config) { const GLint seamless = config.cubemap_interface_filtering ? GL_TRUE : GL_FALSE; UNIMPLEMENTED_IF(config.cubemap_anisotropy != 1); - UNIMPLEMENTED_IF(config.float_coord_normalization != 0); sampler.Create(); const GLuint handle = sampler.handle; diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 43cc94fab..9708dc45e 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -53,7 +53,7 @@ using VideoCommon::FileEnvironment; using VideoCommon::GenericEnvironment; using VideoCommon::GraphicsEnvironment; -constexpr u32 CACHE_VERSION = 5; +constexpr u32 CACHE_VERSION = 6; template <typename Container> auto MakeSpan(Container& container) { @@ -434,7 +434,9 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading state.statistics.get(), false)}; std::scoped_lock lock{state.mutex}; - graphics_cache.emplace(key, std::move(pipeline)); + if (pipeline) { + graphics_cache.emplace(key, std::move(pipeline)); + } ++state.built; if (state.has_loaded) { callback(VideoCore::LoadCallbackStage::Build, state.built, state.total); diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 16e46d3e5..7e40c2df1 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -69,10 +69,17 @@ VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t in const float width = conv(src.scale_x * 2.0f); float y = conv(src.translate_y - src.scale_y); float height = conv(src.scale_y * 2.0f); - if (regs.screen_y_control.y_negate) { + bool y_negate = regs.screen_y_control.y_negate; + + if (!device.IsNvViewportSwizzleSupported()) { + y_negate = y_negate != (src.swizzle.y == Maxwell::ViewportSwizzle::NegativeY); + } + + if (y_negate) { y += height; height = -height; } + const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1.0f : 0.0f; VkViewport viewport{ .x = x, diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 16463a892..caca79d79 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -230,6 +230,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { case Shader::TextureType::Color1D: return VK_IMAGE_VIEW_TYPE_1D; case Shader::TextureType::Color2D: + case Shader::TextureType::Color2DRect: return VK_IMAGE_VIEW_TYPE_2D; case Shader::TextureType::ColorCube: return VK_IMAGE_VIEW_TYPE_CUBE; @@ -254,6 +255,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { case VideoCommon::ImageViewType::e1D: return VK_IMAGE_VIEW_TYPE_1D; case VideoCommon::ImageViewType::e2D: + case VideoCommon::ImageViewType::Rect: return VK_IMAGE_VIEW_TYPE_2D; case VideoCommon::ImageViewType::Cube: return VK_IMAGE_VIEW_TYPE_CUBE; @@ -265,9 +267,6 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { return VK_IMAGE_VIEW_TYPE_2D_ARRAY; case VideoCommon::ImageViewType::CubeArray: return VK_IMAGE_VIEW_TYPE_CUBE_ARRAY; - case VideoCommon::ImageViewType::Rect: - UNIMPLEMENTED_MSG("Rect image view"); - return VK_IMAGE_VIEW_TYPE_2D; case VideoCommon::ImageViewType::Buffer: ASSERT_MSG(false, "Texture buffers can't be image views"); return VK_IMAGE_VIEW_TYPE_1D; @@ -1579,6 +1578,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI break; case VideoCommon::ImageViewType::e2D: case VideoCommon::ImageViewType::e2DArray: + case VideoCommon::ImageViewType::Rect: create(TextureType::Color2D, 1); create(TextureType::ColorArray2D, std::nullopt); render_target = Handle(Shader::TextureType::ColorArray2D); @@ -1592,9 +1592,6 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI create(TextureType::ColorCube, 6); create(TextureType::ColorArrayCube, std::nullopt); break; - case VideoCommon::ImageViewType::Rect: - UNIMPLEMENTED(); - break; case VideoCommon::ImageViewType::Buffer: ASSERT(false); break; diff --git a/src/video_core/shader_environment.cpp b/src/video_core/shader_environment.cpp index c4e923bbf..5f7625947 100644 --- a/src/video_core/shader_environment.cpp +++ b/src/video_core/shader_environment.cpp @@ -39,7 +39,8 @@ static Shader::TextureType ConvertType(const Tegra::Texture::TICEntry& entry) { return Shader::TextureType::Color1D; case Tegra::Texture::TextureType::Texture2D: case Tegra::Texture::TextureType::Texture2DNoMipmap: - return Shader::TextureType::Color2D; + return entry.normalized_coords ? Shader::TextureType::Color2D + : Shader::TextureType::Color2DRect; case Tegra::Texture::TextureType::Texture3D: return Shader::TextureType::Color3D; case Tegra::Texture::TextureType::TextureCubemap: @@ -53,7 +54,8 @@ static Shader::TextureType ConvertType(const Tegra::Texture::TICEntry& entry) { case Tegra::Texture::TextureType::TextureCubeArray: return Shader::TextureType::ColorArrayCube; default: - throw Shader::NotImplementedException("Unknown texture type"); + UNIMPLEMENTED(); + return Shader::TextureType::Color2D; } } |