diff options
author | Jordan Justen <[email protected]> | 2014-10-03 19:07:45 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2015-09-10 16:46:29 -0700 |
commit | 1180b794871e53a94811f7279f42504bca4d9434 (patch) | |
tree | 924bb246c30fcef1986b09d22a60879bb78eeabf /src/mesa/drivers/dri | |
parent | af48612b88cb51cd3b957e70490462c0c404f92c (diff) |
i965: Set up sampler state for compute shaders
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cs.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cs.cpp b/src/mesa/drivers/dri/i965/brw_cs.cpp index 8197e6a69dd..605a3fa0058 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.cpp +++ b/src/mesa/drivers/dri/i965/brw_cs.cpp @@ -225,12 +225,18 @@ brw_codegen_cs_prog(struct brw_context *brw, static void brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key) { + struct gl_context *ctx = &brw->ctx; /* BRW_NEW_COMPUTE_PROGRAM */ const struct brw_compute_program *cp = (struct brw_compute_program *) brw->compute_program; + const struct gl_program *prog = (struct gl_program *) cp; memset(key, 0, sizeof(*key)); + /* _NEW_TEXTURE */ + brw_populate_sampler_prog_key_data(ctx, prog, brw->cs.base.sampler_count, + &key->tex); + /* The unique compute program ID */ key->program_string_id = cp->id; } @@ -248,9 +254,12 @@ brw_upload_cs_prog(struct brw_context *brw) if (!cp) return; - if (!brw_state_dirty(brw, 0, BRW_NEW_COMPUTE_PROGRAM)) + if (!brw_state_dirty(brw, _NEW_TEXTURE, BRW_NEW_COMPUTE_PROGRAM)) return; + brw->cs.base.sampler_count = + _mesa_fls(ctx->ComputeProgram._Current->Base.SamplersUsed); + brw_cs_populate_key(brw, &key); if (!brw_search_cache(&brw->cache, BRW_CACHE_CS_PROG, @@ -413,7 +422,8 @@ brw_upload_cs_state(struct brw_context *brw) if (brw->gen >= 8) desc[dw++] = 0; /* Kernel Start Pointer High */ desc[dw++] = 0; - desc[dw++] = 0; + desc[dw++] = stage_state->sampler_offset | + ((stage_state->sampler_count + 3) / 4); desc[dw++] = stage_state->bind_bo_offset; desc[dw++] = SET_FIELD(push_constant_regs, MEDIA_CURBE_READ_LENGTH); const uint32_t media_threads = |