diff options
| author | Stenzek <stenzek@gmail.com> | 2017-09-05 23:33:15 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-09-05 23:49:42 +1000 |
| commit | 84f8ebd95fc70bc3482a53f31d5ebcc5266bb4b7 (patch) | |
| tree | 7deaef2585f54cb82f004abf0f9f8b5314888183 /Source/Core/VideoCommon | |
| parent | 6d32cce2f5701a897ddd95bf702e5ae29ab1c546 (diff) | |
VideoBackends: Clear uid bits that are unused for the current backend
Currently, this is only the logic op bit, but this will be extended to
the framebuffer fetch/blend modes. In the future, when/if we move to
VideoCommon pipelines, this state will be part of the pipeline UID
anyway, and we can mask it out in the backend by using a two-level map,
so the shaders/programs are shared.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/PixelShaderGen.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/PixelShaderGen.h | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/UberShaderPixel.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/UberShaderPixel.h | 1 |
4 files changed, 22 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 5e561456ab..990f5f938f 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -322,6 +322,16 @@ PixelShaderUid GetPixelShaderUid() return out; } +void ClearUnusedPixelShaderUidBits(APIType ApiType, PixelShaderUid* uid) +{ + pixel_shader_uid_data* uid_data = uid->GetUidData<pixel_shader_uid_data>(); + + // OpenGL and Vulkan convert implicitly normalized color outputs to their uint representation. + // Therefore, it is not necessary to use a uint output on these backends. + if (ApiType != APIType::D3D) + uid_data->uint_output = 0; +} + void WritePixelShaderCommonHeader(ShaderCode& out, APIType ApiType, u32 num_texgens, bool per_pixel_lighting, bool bounding_box) { diff --git a/Source/Core/VideoCommon/PixelShaderGen.h b/Source/Core/VideoCommon/PixelShaderGen.h index 253dc59e22..b480777c41 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.h +++ b/Source/Core/VideoCommon/PixelShaderGen.h @@ -162,5 +162,5 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host const pixel_shader_uid_data* uid_data); void WritePixelShaderCommonHeader(ShaderCode& out, APIType ApiType, u32 num_texgens, bool per_pixel_lighting, bool bounding_box); -ShaderCode GeneratePixelShaderCode(APIType ApiType, const pixel_shader_uid_data* uid_data); +void ClearUnusedPixelShaderUidBits(APIType ApiType, PixelShaderUid* uid); PixelShaderUid GetPixelShaderUid(); diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp index 0ba299260f..494adca95d 100644 --- a/Source/Core/VideoCommon/UberShaderPixel.cpp +++ b/Source/Core/VideoCommon/UberShaderPixel.cpp @@ -29,6 +29,16 @@ PixelShaderUid GetPixelShaderUid() return out; } +void ClearUnusedPixelShaderUidBits(APIType ApiType, PixelShaderUid* uid) +{ + pixel_ubershader_uid_data* uid_data = uid->GetUidData<pixel_ubershader_uid_data>(); + + // OpenGL and Vulkan convert implicitly normalized color outputs to their uint representation. + // Therefore, it is not necessary to use a uint output on these backends. + if (ApiType != APIType::D3D) + uid_data->uint_output = 0; +} + ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config, const pixel_ubershader_uid_data* uid_data) { diff --git a/Source/Core/VideoCommon/UberShaderPixel.h b/Source/Core/VideoCommon/UberShaderPixel.h index 3a5a8f8435..5bacf68a43 100644 --- a/Source/Core/VideoCommon/UberShaderPixel.h +++ b/Source/Core/VideoCommon/UberShaderPixel.h @@ -29,4 +29,5 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config, const pixel_ubershader_uid_data* uid_data); void EnumeratePixelShaderUids(const std::function<void(const PixelShaderUid&)>& callback); +void ClearUnusedPixelShaderUidBits(APIType ApiType, PixelShaderUid* uid); } |
