mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Shader UID change: Only store the two bits of components we need.
This frees up 21 bits and allows us to shorten the UID struct by an entire 32 bits. It's not strictly needed (as it's encoded into the length) but I added a bit for per-pixel lighiting to make my life easier in the following commits.
This commit is contained in:
@ -169,7 +169,6 @@ template <class T>
|
||||
static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
|
||||
{
|
||||
T out;
|
||||
const u32 components = VertexLoaderManager::g_current_components;
|
||||
// Non-uid template parameters will write to the dummy data (=> gets optimized out)
|
||||
pixel_shader_uid_data dummy_data;
|
||||
pixel_shader_uid_data* uid_data = out.template GetUidData<pixel_shader_uid_data>();
|
||||
@ -458,13 +457,18 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
|
||||
"\tfloat3 ldir, h, cosAttn, distAttn;\n"
|
||||
"\tfloat dist, dist2, attn;\n");
|
||||
|
||||
// The lighting shader only needs the two color bits of the 23bit component bit array.
|
||||
uid_data->components =
|
||||
(VertexLoaderManager::g_current_components & (VB_HAS_COL0 | VB_HAS_COL1)) >> VB_COL_SHIFT;
|
||||
;
|
||||
|
||||
// TODO: Our current constant usage code isn't able to handle more than one buffer.
|
||||
// So we can't mark the VS constant as used here. But keep them here as reference.
|
||||
// out.SetConstantsUsed(C_PLIGHT_COLORS, C_PLIGHT_COLORS+7); // TODO: Can be optimized further
|
||||
// out.SetConstantsUsed(C_PLIGHTS, C_PLIGHTS+31); // TODO: Can be optimized further
|
||||
// out.SetConstantsUsed(C_PMATERIALS, C_PMATERIALS+3);
|
||||
uid_data->components = components;
|
||||
GenerateLightingShader<T>(out, uid_data->lighting, components, "colors_", "col");
|
||||
GenerateLightingShader<T>(out, uid_data->lighting, uid_data->components << VB_COL_SHIFT,
|
||||
"colors_", "col");
|
||||
}
|
||||
|
||||
// HACK to handle cases where the tex gen is not enabled
|
||||
|
Reference in New Issue
Block a user