summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader_environment.cpp
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2023-12-22 17:40:26 +0100
committerGitHub <noreply@github.com>2023-12-22 17:40:26 +0100
commit4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0 (patch)
tree5f2cae1f65daf7cdd0b1978e48764747177d949d /src/video_core/shader_environment.cpp
parentMerge pull request #12424 from t895/vsync-per-game-qt (diff)
parentshader_recompiler: use float image operations on load/store when required (diff)
downloadyuzu-4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0.tar
yuzu-4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0.tar.gz
yuzu-4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0.tar.bz2
yuzu-4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0.tar.lz
yuzu-4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0.tar.xz
yuzu-4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0.tar.zst
yuzu-4d6b6ba76ccf73a47ed46a5c86452cf2be03e2e0.zip
Diffstat (limited to 'src/video_core/shader_environment.cpp')
-rw-r--r--src/video_core/shader_environment.cpp35
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
}
static Shader::TexturePixelFormat ConvertTexturePixelFormat(const Tegra::Texture::TICEntry& entry) {
- switch (PixelFormatFromTextureInfo(entry.format, entry.r_type, entry.g_type, entry.b_type,
- entry.a_type, entry.srgb_conversion)) {
- case VideoCore::Surface::PixelFormat::A8B8G8R8_SNORM:
- return Shader::TexturePixelFormat::A8B8G8R8_SNORM;
- case VideoCore::Surface::PixelFormat::R8_SNORM:
- return Shader::TexturePixelFormat::R8_SNORM;
- case VideoCore::Surface::PixelFormat::R8G8_SNORM:
- return Shader::TexturePixelFormat::R8G8_SNORM;
- case VideoCore::Surface::PixelFormat::R16G16B16A16_SNORM:
- return Shader::TexturePixelFormat::R16G16B16A16_SNORM;
- case VideoCore::Surface::PixelFormat::R16G16_SNORM:
- return Shader::TexturePixelFormat::R16G16_SNORM;
- case VideoCore::Surface::PixelFormat::R16_SNORM:
- return Shader::TexturePixelFormat::R16_SNORM;
- default:
- return Shader::TexturePixelFormat::OTHER;
- }
+ return static_cast<Shader::TexturePixelFormat>(
+ PixelFormatFromTextureInfo(entry.format, entry.r_type, entry.g_type, entry.b_type,
+ entry.a_type, entry.srgb_conversion));
}
static std::string_view StageToPrefix(Shader::Stage stage) {
@@ -398,6 +384,11 @@ Shader::TexturePixelFormat GraphicsEnvironment::ReadTexturePixelFormat(u32 handl
return result;
}
+bool GraphicsEnvironment::IsTexturePixelFormatInteger(u32 handle) {
+ return VideoCore::Surface::IsPixelFormatInteger(
+ static_cast<VideoCore::Surface::PixelFormat>(ReadTexturePixelFormat(handle)));
+}
+
u32 GraphicsEnvironment::ReadViewportTransformState() {
const auto& regs{maxwell3d->regs};
viewport_transform_state = regs.viewport_scale_offset_enabled;
@@ -448,6 +439,11 @@ Shader::TexturePixelFormat ComputeEnvironment::ReadTexturePixelFormat(u32 handle
return result;
}
+bool ComputeEnvironment::IsTexturePixelFormatInteger(u32 handle) {
+ return VideoCore::Surface::IsPixelFormatInteger(
+ static_cast<VideoCore::Surface::PixelFormat>(ReadTexturePixelFormat(handle)));
+}
+
u32 ComputeEnvironment::ReadViewportTransformState() {
return viewport_transform_state;
}
@@ -551,6 +547,11 @@ Shader::TexturePixelFormat FileEnvironment::ReadTexturePixelFormat(u32 handle) {
return it->second;
}
+bool FileEnvironment::IsTexturePixelFormatInteger(u32 handle) {
+ return VideoCore::Surface::IsPixelFormatInteger(
+ static_cast<VideoCore::Surface::PixelFormat>(ReadTexturePixelFormat(handle)));
+}
+
u32 FileEnvironment::ReadViewportTransformState() {
return viewport_transform_state;
}