aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs_surface_state.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs_surface_state.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes_surface_state.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c24
-rw-r--r--src/mesa/main/mtypes.h40
-rw-r--r--src/mesa/main/uniform_query.cpp2
-rw-r--r--src/mesa/state_tracker/st_atom_image.c3
10 files changed, 46 insertions, 63 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 032b5ec16aa..0b9d2a05bf6 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -280,7 +280,8 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
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) {
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 113974badc8..628840e7cf3 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1465,7 +1465,6 @@ void brw_upload_abo_surfaces(struct brw_context *brw,
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);
diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
index cf56acfd99a..e2ef222b08c 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
@@ -122,16 +122,13 @@ const struct brw_tracked_state brw_gs_abo_surfaces = {
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);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
index b2d075fe6bf..16f0bd2f96e 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
@@ -123,16 +123,13 @@ const struct brw_tracked_state brw_tcs_abo_surfaces = {
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);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
index a3516834ce4..f74d86961e2 100644
--- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
@@ -123,16 +123,13 @@ const struct brw_tracked_state brw_tes_abo_surfaces = {
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);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index 7bc7b77e9cf..6c349f400ec 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -188,16 +188,13 @@ const struct brw_tracked_state brw_vs_abo_surfaces = {
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);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 6c44381be13..34fec7e7d94 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1564,16 +1564,13 @@ const struct brw_tracked_state brw_cs_abo_surfaces = {
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);
}
}
@@ -1780,7 +1777,6 @@ update_image_surface(struct brw_context *brw,
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)
@@ -1788,12 +1784,12 @@ brw_upload_image_surfaces(struct brw_context *brw,
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]);
@@ -1811,15 +1807,13 @@ brw_upload_image_surfaces(struct brw_context *brw,
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);
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 2693a8068c0..fa14c87a2c0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1980,6 +1980,25 @@ struct gl_program
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 {
/**
@@ -2375,28 +2394,9 @@ struct gl_linked_shader
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;
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 3108d348d6f..ec6d2774844 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -908,7 +908,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
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];
}
}
diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c
index a7b7371bfee..b30006a143c 100644
--- a/src/mesa/state_tracker/st_atom_image.c
+++ b/src/mesa/state_tracker/st_atom_image.c
@@ -58,7 +58,8 @@ st_bind_images(struct st_context *st, struct gl_linked_shader *shader,
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];