nv2a: Update VSH constants only if different

This commit is contained in:
Matt Borgerson 2021-03-11 01:01:19 -07:00 committed by mborgerson
parent 93a29154e3
commit 9ab3dcbd6c
2 changed files with 8 additions and 2 deletions

View File

@ -3575,9 +3575,14 @@ static void pgraph_shader_update_constants(PGRAPHState *pg,
if (!pg->vsh_constants_dirty[i] && !binding_changed) continue;
GLint loc = binding->vsh_constant_loc[i];
if (loc != -1) {
glUniform4fv(loc, 1, (const GLfloat*)pg->vsh_constants[i]);
if ((loc != -1) &&
memcmp(binding->vsh_constants[i], pg->vsh_constants[i],
sizeof(pg->vsh_constants[1]))) {
glUniform4fv(loc, 1, (const GLfloat *)pg->vsh_constants[i]);
memcpy(binding->vsh_constants[i], pg->vsh_constants[i],
sizeof(pg->vsh_constants[i]));
}
pg->vsh_constants_dirty[i] = false;
}

View File

@ -105,6 +105,7 @@ typedef struct ShaderBinding {
GLint clip_range_loc;
GLint vsh_constant_loc[NV2A_VERTEXSHADER_CONSTANTS];
uint32_t vsh_constants[NV2A_VERTEXSHADER_CONSTANTS][4];
GLint inv_viewport_loc;
GLint ltctxa_loc[NV2A_LTCTXA_COUNT];