mesa: fix 38% decrease in display list performance of Viewperf2020/NX8_StudioAA
It happened because glCallList was restoring varying_vp_inputs, which caused every glCallList to process the state change again. This loosely reverts commit3a294ff01f
"mesa: move the _mesa_set_varying_vp_inputs call to where the state changes". Fixes:3a294ff01f
- "mesa: move the _mesa_set_varying_vp_inputs call to where the state changes" Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24165>
This commit is contained in:
@@ -147,7 +147,6 @@ _mesa_save_and_set_draw_vao(struct gl_context *ctx,
|
||||
ctx->Array._DrawVAO = NULL;
|
||||
ctx->VertexProgram._VPModeInputFilter = vp_input_filter;
|
||||
_mesa_set_draw_vao(ctx, vao);
|
||||
_mesa_set_varying_vp_inputs(ctx, vp_input_filter & vao->_EnabledWithMapMode);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -166,8 +165,6 @@ _mesa_restore_draw_vao(struct gl_context *ctx,
|
||||
|
||||
/* Restore original states. */
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
saved->_EnabledWithMapMode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1395,6 +1392,8 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1423,6 +1422,8 @@ _mesa_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1452,6 +1453,8 @@ _mesa_DrawArraysInstancedBaseInstance(GLenum mode, GLint first,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1480,6 +1483,8 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1720,6 +1725,8 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1814,6 +1821,8 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1837,6 +1846,8 @@ _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1860,6 +1871,8 @@ _mesa_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1886,6 +1899,8 @@ _mesa_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1914,6 +1929,8 @@ _mesa_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1944,6 +1961,8 @@ _mesa_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -1972,6 +1991,8 @@ _mesa_DrawElementsUserBuf(GLintptr indexBuf, GLenum mode,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2139,6 +2160,8 @@ _mesa_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2164,6 +2187,8 @@ _mesa_MultiDrawElementsBaseVertex(GLenum mode,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2193,6 +2218,8 @@ _mesa_MultiDrawElementsUserBuf(GLintptr indexBuf, GLenum mode,
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2225,6 +2252,8 @@ _mesa_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
|
||||
{
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2328,6 +2357,8 @@ _mesa_DrawArraysIndirect(GLenum mode, const GLvoid *indirect)
|
||||
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2383,6 +2414,8 @@ _mesa_DrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect)
|
||||
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2406,6 +2439,8 @@ _mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
|
||||
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2475,6 +2510,8 @@ _mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
|
||||
|
||||
FLUSH_FOR_DRAW(ctx);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2587,6 +2624,8 @@ _mesa_MultiDrawArraysIndirectCountARB(GLenum mode, GLintptr indirect,
|
||||
if (stride == 0)
|
||||
stride = 4 * sizeof(GLuint); /* sizeof(DrawArraysIndirectCommand) */
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
@@ -2614,6 +2653,8 @@ _mesa_MultiDrawElementsIndirectCountARB(GLenum mode, GLenum type,
|
||||
if (stride == 0)
|
||||
stride = 5 * sizeof(GLuint); /* sizeof(DrawElementsIndirectCommand) */
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
|
@@ -687,9 +687,6 @@ set_vertex_processing_mode(struct gl_context *ctx, gl_vertex_processing_mode m)
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2159,9 +2159,6 @@ _mesa_enable_vertex_array_attribs(struct gl_context *ctx,
|
||||
|
||||
vao->_EnabledWithMapMode =
|
||||
_mesa_vao_enable_to_vp_inputs(vao->_AttributeMapMode, vao->Enabled);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
vao->_EnabledWithMapMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2265,9 +2262,6 @@ _mesa_disable_vertex_array_attribs(struct gl_context *ctx,
|
||||
|
||||
vao->_EnabledWithMapMode =
|
||||
_mesa_vao_enable_to_vp_inputs(vao->_AttributeMapMode, vao->Enabled);
|
||||
|
||||
_mesa_set_varying_vp_inputs(ctx, ctx->VertexProgram._VPModeInputFilter &
|
||||
vao->_EnabledWithMapMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -274,6 +274,8 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
|
||||
|
||||
_mesa_save_and_set_draw_vao(ctx, rs->VAO, VERT_BIT_POS,
|
||||
&old_vao, &old_vp_input_filter);
|
||||
_mesa_set_varying_vp_inputs(ctx, VERT_BIT_POS &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
|
||||
st_feedback_draw_vbo(ctx, &rs->info, 0, &rs->draw, 1);
|
||||
|
||||
|
@@ -151,6 +151,8 @@ vbo_exec_bind_arrays(struct gl_context *ctx,
|
||||
|
||||
_mesa_save_and_set_draw_vao(ctx, vao, vao_filter,
|
||||
old_vao, old_vp_input_filter);
|
||||
_mesa_set_varying_vp_inputs(ctx, vao_filter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -207,7 +207,6 @@ vbo_save_playback_vertex_list_gallium(struct gl_context *ctx,
|
||||
* which attribs have stride = 0 and whether edge flags are enabled.
|
||||
*/
|
||||
const GLbitfield enabled = node->enabled_attribs[mode];
|
||||
const GLbitfield saved_varying_vp_inputs = ctx->VertexProgram._VaryingInputs;
|
||||
_mesa_set_varying_vp_inputs(ctx, enabled);
|
||||
|
||||
if (ctx->NewState)
|
||||
@@ -294,7 +293,6 @@ vbo_save_playback_vertex_list_gallium(struct gl_context *ctx,
|
||||
|
||||
/* Restore edge flag state and ctx->VertexProgram._VaryingInputs. */
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
_mesa_set_varying_vp_inputs(ctx, saved_varying_vp_inputs);
|
||||
|
||||
if (copy_to_current)
|
||||
playback_copy_to_current(ctx, node);
|
||||
@@ -334,6 +332,8 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data, bool copy_to_c
|
||||
|
||||
_mesa_save_and_set_draw_vao(ctx, node->cold->VAO[mode], vao_filter,
|
||||
&old_vao, &old_vp_input_filter);
|
||||
_mesa_set_varying_vp_inputs(ctx, vao_filter &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
|
||||
/* Need that at least one time. */
|
||||
if (ctx->NewState)
|
||||
|
Reference in New Issue
Block a user