diff options
| author | 2023-12-19 10:55:56 -0500 | |
|---|---|---|
| committer | 2023-12-21 14:34:46 -0500 | |
| commit | 9e9aed41bebc1b7d29dbfcddcc203693bcdc680e (patch) | |
| tree | 5f2cae1f65daf7cdd0b1978e48764747177d949d /src/video_core/shader_environment.cpp | |
| parent | Merge pull request #12424 from t895/vsync-per-game-qt (diff) | |
| download | yuzu-9e9aed41bebc1b7d29dbfcddcc203693bcdc680e.tar.gz yuzu-9e9aed41bebc1b7d29dbfcddcc203693bcdc680e.tar.xz yuzu-9e9aed41bebc1b7d29dbfcddcc203693bcdc680e.zip | |
shader_recompiler: use float image operations on load/store when required
Diffstat (limited to 'src/video_core/shader_environment.cpp')
| -rw-r--r-- | src/video_core/shader_environment.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/video_core/shader_environment.cpp b/src/video_core/shader_environment.cpp index 4edbe5700..492440ac4 100644 --- a/src/video_core/shader_environment.cpp +++ b/src/video_core/shader_environment.cpp | |||
| @@ -62,23 +62,9 @@ static Shader::TextureType ConvertTextureType(const Tegra::Texture::TICEntry& en | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static Shader::TexturePixelFormat ConvertTexturePixelFormat(const Tegra::Texture::TICEntry& entry) { | 64 | static Shader::TexturePixelFormat ConvertTexturePixelFormat(const Tegra::Texture::TICEntry& entry) { |
| 65 | switch (PixelFormatFromTextureInfo(entry.format, entry.r_type, entry.g_type, entry.b_type, | 65 | return static_cast<Shader::TexturePixelFormat>( |
| 66 | entry.a_type, entry.srgb_conversion)) { | 66 | PixelFormatFromTextureInfo(entry.format, entry.r_type, entry.g_type, entry.b_type, |
| 67 | case VideoCore::Surface::PixelFormat::A8B8G8R8_SNORM: | 67 | entry.a_type, entry.srgb_conversion)); |
| 68 | return Shader::TexturePixelFormat::A8B8G8R8_SNORM; | ||
| 69 | case VideoCore::Surface::PixelFormat::R8_SNORM: | ||
| 70 | return Shader::TexturePixelFormat::R8_SNORM; | ||
| 71 | case VideoCore::Surface::PixelFormat::R8G8_SNORM: | ||
| 72 | return Shader::TexturePixelFormat::R8G8_SNORM; | ||
| 73 | case VideoCore::Surface::PixelFormat::R16G16B16A16_SNORM: | ||
| 74 | return Shader::TexturePixelFormat::R16G16B16A16_SNORM; | ||
| 75 | case VideoCore::Surface::PixelFormat::R16G16_SNORM: | ||
| 76 | return Shader::TexturePixelFormat::R16G16_SNORM; | ||
| 77 | case VideoCore::Surface::PixelFormat::R16_SNORM: | ||
| 78 | return Shader::TexturePixelFormat::R16_SNORM; | ||
| 79 | default: | ||
| 80 | return Shader::TexturePixelFormat::OTHER; | ||
| 81 | } | ||
| 82 | } | 68 | } |
| 83 | 69 | ||
| 84 | static std::string_view StageToPrefix(Shader::Stage stage) { | 70 | static std::string_view StageToPrefix(Shader::Stage stage) { |
| @@ -398,6 +384,11 @@ Shader::TexturePixelFormat GraphicsEnvironment::ReadTexturePixelFormat(u32 handl | |||
| 398 | return result; | 384 | return result; |
| 399 | } | 385 | } |
| 400 | 386 | ||
| 387 | bool GraphicsEnvironment::IsTexturePixelFormatInteger(u32 handle) { | ||
| 388 | return VideoCore::Surface::IsPixelFormatInteger( | ||
| 389 | static_cast<VideoCore::Surface::PixelFormat>(ReadTexturePixelFormat(handle))); | ||
| 390 | } | ||
| 391 | |||
| 401 | u32 GraphicsEnvironment::ReadViewportTransformState() { | 392 | u32 GraphicsEnvironment::ReadViewportTransformState() { |
| 402 | const auto& regs{maxwell3d->regs}; | 393 | const auto& regs{maxwell3d->regs}; |
| 403 | viewport_transform_state = regs.viewport_scale_offset_enabled; | 394 | viewport_transform_state = regs.viewport_scale_offset_enabled; |
| @@ -448,6 +439,11 @@ Shader::TexturePixelFormat ComputeEnvironment::ReadTexturePixelFormat(u32 handle | |||
| 448 | return result; | 439 | return result; |
| 449 | } | 440 | } |
| 450 | 441 | ||
| 442 | bool ComputeEnvironment::IsTexturePixelFormatInteger(u32 handle) { | ||
| 443 | return VideoCore::Surface::IsPixelFormatInteger( | ||
| 444 | static_cast<VideoCore::Surface::PixelFormat>(ReadTexturePixelFormat(handle))); | ||
| 445 | } | ||
| 446 | |||
| 451 | u32 ComputeEnvironment::ReadViewportTransformState() { | 447 | u32 ComputeEnvironment::ReadViewportTransformState() { |
| 452 | return viewport_transform_state; | 448 | return viewport_transform_state; |
| 453 | } | 449 | } |
| @@ -551,6 +547,11 @@ Shader::TexturePixelFormat FileEnvironment::ReadTexturePixelFormat(u32 handle) { | |||
| 551 | return it->second; | 547 | return it->second; |
| 552 | } | 548 | } |
| 553 | 549 | ||
| 550 | bool FileEnvironment::IsTexturePixelFormatInteger(u32 handle) { | ||
| 551 | return VideoCore::Surface::IsPixelFormatInteger( | ||
| 552 | static_cast<VideoCore::Surface::PixelFormat>(ReadTexturePixelFormat(handle))); | ||
| 553 | } | ||
| 554 | |||
| 554 | u32 FileEnvironment::ReadViewportTransformState() { | 555 | u32 FileEnvironment::ReadViewportTransformState() { |
| 555 | return viewport_transform_state; | 556 | return viewport_transform_state; |
| 556 | } | 557 | } |