X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmesa%2Fstate_tracker%2Fst_atom_constbuf.c;h=f1d08a3e1665e5cdb118eec3c6828193a686e971;hb=b830b62a47dec70640062c488cbebd2c8ac487f9;hp=a8f2b879d532c511c8d04476ac94c063532c128b;hpb=c7f5c9a3dc6350252e73b541bb85ab3ed9e64a9c;p=mesa.git diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index a8f2b879d53..f1d08a3e166 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -32,8 +32,8 @@ */ #include "main/imports.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" +#include "program/prog_parameter.h" +#include "program/prog_print.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -44,7 +44,6 @@ #include "st_atom.h" #include "st_atom_constbuf.h" #include "st_program.h" -#include "st_inlines.h" /** @@ -60,12 +59,18 @@ void st_upload_constants( struct st_context *st, struct pipe_resource **cbuf = &st->state.constants[shader_type]; assert(shader_type == PIPE_SHADER_VERTEX || - shader_type == PIPE_SHADER_FRAGMENT); + shader_type == PIPE_SHADER_FRAGMENT || + shader_type == PIPE_SHADER_GEOMETRY); /* update constants */ if (params && params->NumParameters) { const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4; + /* Update the constants which come from fixed-function state, such as + * transformation matrices, fog factors, etc. The rest of the values in + * the parameters list are explicitly set by the user with glUniform, + * glProgramParameter(), etc. + */ _mesa_load_state_parameters(st->ctx, params); /* We always need to get a new buffer, to keep the drivers simple and @@ -84,14 +89,17 @@ void st_upload_constants( struct st_context *st, } /* load Mesa constants into the constant buffer */ - st_no_flush_pipe_buffer_write(st, *cbuf, + pipe_buffer_write(st->pipe, *cbuf, 0, paramBytes, params->ParameterValues); st->pipe->set_constant_buffer(st->pipe, shader_type, 0, *cbuf); } - else { + else if (*cbuf) { st->constants.tracked_state[shader_type].dirty.mesa = 0x0; + + pipe_resource_reference(cbuf, NULL); + st->pipe->set_constant_buffer(st->pipe, shader_type, 0, NULL); } } @@ -140,3 +148,24 @@ const struct st_tracked_state st_update_fs_constants = { update_fs_constants /* update */ }; +/* Geometry shader: + */ +static void update_gs_constants(struct st_context *st ) +{ + struct st_geometry_program *gp = st->gp; + struct gl_program_parameter_list *params; + + if (gp) { + params = gp->Base.Base.Parameters; + st_upload_constants( st, params, PIPE_SHADER_GEOMETRY ); + } +} + +const struct st_tracked_state st_update_gs_constants = { + "st_update_gs_constants", /* name */ + { /* dirty */ + (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */ + ST_NEW_GEOMETRY_PROGRAM, /* st */ + }, + update_gs_constants /* update */ +};