storage->opaque[sh].active) {
for (unsigned i = 0; i < elements; i++) {
const unsigned index = storage->opaque[sh].index + i;
- if (index >= ARRAY_SIZE(shader->ImageUnits))
+ if (index >= ARRAY_SIZE(shader->Program->sh.ImageUnits))
break;
- shader->ImageUnits[index] = storage->storage[i].i;
+ shader->Program->sh.ImageUnits[index] =
+ storage->storage[i].i;
}
}
}
this->next_image += MAX2(1, uniform->array_elements);
for (unsigned i = first; i < MIN2(next_image, MAX_IMAGE_UNIFORMS); i++)
- prog->_LinkedShaders[shader_type]->ImageAccess[i] = access;
+ prog->_LinkedShaders[shader_type]->Program->sh.ImageAccess[i] = access;
}
}
* types cannot have initializers."
*/
memset(sh->SamplerUnits, 0, sizeof(sh->SamplerUnits));
- memset(sh->ImageUnits, 0, sizeof(sh->ImageUnits));
link_update_uniform_buffer_variables(sh, i);
if (unlikely(shader && shader->Program->info.num_images)) {
for (unsigned j = 0; j < shader->Program->info.num_images; j++) {
- struct gl_image_unit *u = &ctx->ImageUnits[shader->ImageUnits[j]];
+ struct gl_image_unit *u =
+ &ctx->ImageUnits[shader->Program->sh.ImageUnits[j]];
tex_obj = intel_texture_object(u->TexObj);
if (tex_obj && tex_obj->mt) {
struct brw_stage_state *stage_state,
struct brw_stage_prog_data *prog_data);
void brw_upload_image_surfaces(struct brw_context *brw,
- struct gl_linked_shader *shader,
const struct gl_program *prog,
struct brw_stage_state *stage_state,
struct brw_stage_prog_data *prog_data);
static void
brw_upload_gs_image_surfaces(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_GEOMETRY_PROGRAM */
- struct gl_shader_program *prog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
const struct gl_program *gp = brw->geometry_program;
- if (gp && prog) {
+ if (gp) {
/* BRW_NEW_GS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
- brw_upload_image_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_GEOMETRY],
- gp, &brw->gs.base, brw->gs.base.prog_data);
+ brw_upload_image_surfaces(brw, gp, &brw->gs.base,
+ brw->gs.base.prog_data);
}
}
static void
brw_upload_tcs_image_surfaces(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_TESS_PROGRAMS */
- struct gl_shader_program *prog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
const struct gl_program *tcp = brw->tess_ctrl_program;
- if (tcp && prog) {
+ if (tcp) {
/* BRW_NEW_TCS_PROG_DATA, BRW_NEW_IMAGE_UNITS */
- brw_upload_image_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_CTRL],
- tcp, &brw->tcs.base, brw->tcs.base.prog_data);
+ brw_upload_image_surfaces(brw, tcp, &brw->tcs.base,
+ brw->tcs.base.prog_data);
}
}
static void
brw_upload_tes_image_surfaces(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_TESS_PROGRAMS */
- struct gl_shader_program *prog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
const struct gl_program *tep = brw->tess_eval_program;
- if (tep && prog) {
+ if (tep) {
/* BRW_NEW_TES_PROG_DATA, BRW_NEW_IMAGE_UNITS */
- brw_upload_image_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_TESS_EVAL],
- tep, &brw->tes.base, brw->tes.base.prog_data);
+ brw_upload_image_surfaces(brw, tep, &brw->tes.base,
+ brw->tes.base.prog_data);
}
}
static void
brw_upload_vs_image_surfaces(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_VERTEX_PROGRAM */
- struct gl_shader_program *prog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
const struct gl_program *vp = brw->vertex_program;
- if (vp && prog) {
+ if (vp) {
/* BRW_NEW_VS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
- brw_upload_image_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_VERTEX],
- vp, &brw->vs.base, brw->vs.base.prog_data);
+ brw_upload_image_surfaces(brw, vp, &brw->vs.base,
+ brw->vs.base.prog_data);
}
}
static void
brw_upload_cs_image_surfaces(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog =
- ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
const struct gl_program *cp = brw->compute_program;
- if (cp && prog) {
+ if (cp) {
/* BRW_NEW_CS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
- brw_upload_image_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_COMPUTE],
- cp, &brw->cs.base, brw->cs.base.prog_data);
+ brw_upload_image_surfaces(brw, cp, &brw->cs.base,
+ brw->cs.base.prog_data);
}
}
void
brw_upload_image_surfaces(struct brw_context *brw,
- struct gl_linked_shader *shader,
const struct gl_program *prog,
struct brw_stage_state *stage_state,
struct brw_stage_prog_data *prog_data)
assert(prog);
struct gl_context *ctx = &brw->ctx;
- if (prog->info.num_images && shader) {
+ if (prog->info.num_images) {
for (unsigned i = 0; i < prog->info.num_images; i++) {
- struct gl_image_unit *u = &ctx->ImageUnits[shader->ImageUnits[i]];
+ struct gl_image_unit *u = &ctx->ImageUnits[prog->sh.ImageUnits[i]];
const unsigned surf_idx = prog_data->binding_table.image_start + i;
- update_image_surface(brw, u, shader->ImageAccess[i],
+ update_image_surface(brw, u, prog->sh.ImageAccess[i],
surf_idx,
&stage_state->surf_offset[surf_idx],
&prog_data->image_param[i]);
static void
brw_upload_wm_image_surfaces(struct brw_context *brw)
{
- struct gl_context *ctx = &brw->ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
- struct gl_shader_program *prog = ctx->_Shader->_CurrentFragmentProgram;
const struct gl_program *wm = brw->fragment_program;
- if (wm && prog) {
+ if (wm) {
/* BRW_NEW_FS_PROG_DATA, BRW_NEW_IMAGE_UNITS, _NEW_TEXTURE */
- brw_upload_image_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
- wm, &brw->wm.base, brw->wm.base.prog_data);
+ brw_upload_image_surfaces(brw, wm, &brw->wm.base,
+ brw->wm.base.prog_data);
}
}
GLuint MaxSubroutineFunctionIndex;
struct gl_subroutine_function *SubroutineFunctions;
+ /**
+ * Map from image uniform index to image unit (set by glUniform1i())
+ *
+ * An image uniform index is associated with each image uniform by
+ * the linker. The image index associated with each uniform is
+ * stored in the \c gl_uniform_storage::image field.
+ */
+ GLubyte ImageUnits[MAX_IMAGE_UNIFORMS];
+
+ /**
+ * Access qualifier specified in the shader for each image uniform
+ * index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY or \c
+ * GL_READ_WRITE.
+ *
+ * It may be different, though only more strict than the value of
+ * \c gl_image_unit::Access for the corresponding image unit.
+ */
+ GLenum ImageAccess[MAX_IMAGE_UNIFORMS];
+
union {
struct {
/**
struct exec_list *fragdata_arrays;
struct glsl_symbol_table *symbols;
- /**
- * Map from image uniform index to image unit (set by glUniform1i())
- *
- * An image uniform index is associated with each image uniform by
- * the linker. The image index associated with each uniform is
- * stored in the \c gl_uniform_storage::image field.
- */
- GLubyte ImageUnits[MAX_IMAGE_UNIFORMS];
-
- /**
- * Access qualifier specified in the shader for each image uniform
- * index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY or \c
- * GL_READ_WRITE.
- *
- * It may be different, though only more strict than the value of
- * \c gl_image_unit::Access for the corresponding image unit.
- */
- GLenum ImageAccess[MAX_IMAGE_UNIFORMS];
-
/**
* Number of image uniforms defined in the shader. It specifies
* the number of valid elements in the \c ImageUnits and \c
- * ImageAccess arrays above.
+ * ImageAccess arrays.
*/
GLuint NumImages;
struct gl_linked_shader *sh = shProg->_LinkedShaders[i];
for (int j = 0; j < count; j++)
- sh->ImageUnits[uni->opaque[i].index + offset + j] =
+ sh->Program->sh.ImageUnits[uni->opaque[i].index + offset + j] =
((GLint *) values)[j];
}
}
c = &st->ctx->Const.Program[shader->Stage];
for (i = 0; i < shader->NumImages; i++) {
- struct gl_image_unit *u = &st->ctx->ImageUnits[shader->ImageUnits[i]];
+ struct gl_image_unit *u =
+ &st->ctx->ImageUnits[shader->Program->sh.ImageUnits[i]];
struct st_texture_object *stObj = st_texture_object(u->TexObj);
struct pipe_image_view *img = &images[i];