mesa: move shader pipeline validation from draws to state changes

This is a step towards removing _mesa_valid_to_render.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
This commit is contained in:
Marek Olšák 2021-01-30 18:59:10 -05:00 committed by Marge Bot
parent d45043d3b8
commit d9c611d671
4 changed files with 13 additions and 11 deletions

View file

@ -42,6 +42,7 @@
#include "main/clear.h"
#include "main/condrender.h"
#include "main/draw.h"
#include "main/draw_validate.h"
#include "main/depth.h"
#include "main/enable.h"
#include "main/fbobject.h"
@ -1033,6 +1034,7 @@ _mesa_meta_end(struct gl_context *ctx)
}
_mesa_update_vertex_processing_mode(ctx);
_mesa_update_valid_to_render_state(ctx);
}
if (state & MESA_META_STENCIL_TEST) {

View file

@ -160,16 +160,6 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
}
}
/* A pipeline object is bound */
if (ctx->_Shader->Name && !ctx->_Shader->Validated) {
if (!_mesa_validate_program_pipeline(ctx, ctx->_Shader)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glValidateProgramPipeline failed to validate the "
"pipeline");
return GL_FALSE;
}
}
/* If a program is active and SSO not in use, check if validation of
* samplers succeeded for the active program. */
if (ctx->_Shader->ActiveProgram && ctx->_Shader != ctx->Pipeline.Current) {
@ -261,7 +251,10 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx)
ctx->ValidPrimMask = 0;
ctx->DrawPixValid = false;
/* TODO: insert code here */
/* A pipeline object is bound */
if (shader->Name && !shader->Validated &&
!_mesa_validate_program_pipeline(ctx, shader))
return;
/* DrawPixels/CopyPixels/Bitmap is valid after this point. */
ctx->DrawPixValid = true;

View file

@ -254,6 +254,9 @@ use_program_stages(struct gl_context *ctx, struct gl_shader_program *shProg,
use_program_stage(ctx, GL_COMPUTE_SHADER, shProg, pipe);
pipe->Validated = pipe->UserValidated = false;
if (pipe == ctx->_Shader)
_mesa_update_valid_to_render_state(ctx);
}
void GLAPIENTRY
@ -408,6 +411,8 @@ active_shader_program(struct gl_context *ctx, GLuint pipeline, GLuint program,
}
_mesa_reference_shader_program(ctx, &pipe->ActiveProgram, shProg);
if (pipe == ctx->_Shader)
_mesa_update_valid_to_render_state(ctx);
}
void GLAPIENTRY

View file

@ -1394,6 +1394,7 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg,
}
_mesa_update_vertex_processing_mode(ctx);
_mesa_update_valid_to_render_state(ctx);
shProg->BinaryRetrievableHint = shProg->BinaryRetrievableHintPending;
@ -1489,6 +1490,7 @@ _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
if (ctx->Shader.ActiveProgram != shProg) {
_mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, shProg);
_mesa_update_valid_to_render_state(ctx);
}
}