mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
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.
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user