summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-10-09 17:07:23 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-11-04 10:18:56 -0800
commit817e9b5c5b284205ee4c0508f5cd0483321392a4 (patch)
tree516cccbf3aece908d27352641569e71e1a7b65b9
parent6b35f4d8decec69c38e929856a9918486ff7cbf7 (diff)
i965: Add HS/DS sampler support.
Based on code by Chris Forbes and Fabian Bieler. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/mesa/drivers/dri/i965/brw_sampler_state.c46
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c4
3 files changed, 52 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 6d73444dad..e758786dab 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -55,6 +55,8 @@ gen7_emit_sampler_state_pointers_xs(struct brw_context *brw,
{
static const uint16_t packet_headers[] = {
[MESA_SHADER_VERTEX] = _3DSTATE_SAMPLER_STATE_POINTERS_VS,
+ [MESA_SHADER_TESS_CTRL] = _3DSTATE_SAMPLER_STATE_POINTERS_HS,
+ [MESA_SHADER_TESS_EVAL] = _3DSTATE_SAMPLER_STATE_POINTERS_DS,
[MESA_SHADER_GEOMETRY] = _3DSTATE_SAMPLER_STATE_POINTERS_GS,
[MESA_SHADER_FRAGMENT] = _3DSTATE_SAMPLER_STATE_POINTERS_PS,
};
@@ -647,3 +649,47 @@ const struct brw_tracked_state brw_gs_samplers = {
},
.emit = brw_upload_gs_samplers,
};
+
+
+static void
+brw_upload_hs_samplers(struct brw_context *brw)
+{
+ /* BRW_NEW_TESS_CTRL_PROGRAM */
+ struct gl_program *hs = (struct gl_program *) brw->tess_ctrl_program;
+ if (!hs)
+ return;
+
+ brw_upload_sampler_state_table(brw, hs, &brw->hs.base);
+}
+
+
+const struct brw_tracked_state brw_hs_samplers = {
+ .dirty = {
+ .mesa = _NEW_TEXTURE,
+ .brw = BRW_NEW_BATCH |
+ BRW_NEW_TESS_CTRL_PROGRAM,
+ },
+ .emit = brw_upload_hs_samplers,
+};
+
+
+static void
+brw_upload_ds_samplers(struct brw_context *brw)
+{
+ /* BRW_NEW_TESS_EVAL_PROGRAM */
+ struct gl_program *ds = (struct gl_program *) brw->tess_eval_program;
+ if (!ds)
+ return;
+
+ brw_upload_sampler_state_table(brw, ds, &brw->ds.base);
+}
+
+
+const struct brw_tracked_state brw_ds_samplers = {
+ .dirty = {
+ .mesa = _NEW_TEXTURE,
+ .brw = BRW_NEW_BATCH |
+ BRW_NEW_TESS_EVAL_PROGRAM,
+ },
+ .emit = brw_upload_ds_samplers,
+};
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 657f47fe68..416b62e9a6 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -72,6 +72,8 @@ extern const struct brw_tracked_state brw_state_base_address;
extern const struct brw_tracked_state brw_urb_fence;
extern const struct brw_tracked_state brw_vs_prog;
extern const struct brw_tracked_state brw_vs_samplers;
+extern const struct brw_tracked_state brw_hs_samplers;
+extern const struct brw_tracked_state brw_ds_samplers;
extern const struct brw_tracked_state brw_gs_samplers;
extern const struct brw_tracked_state brw_vs_ubo_surfaces;
extern const struct brw_tracked_state brw_vs_abo_surfaces;
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index b61a81a682..d8b21339db 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -232,6 +232,8 @@ static const struct brw_tracked_state *gen7_render_atoms[] =
&brw_fs_samplers, /* Is there a reason this goes first? */
&brw_vs_samplers,
+ &brw_hs_samplers,
+ &brw_ds_samplers,
&brw_gs_samplers,
&gen6_multisample_state,
@@ -332,6 +334,8 @@ static const struct brw_tracked_state *gen8_render_atoms[] =
&brw_fs_samplers,
&brw_vs_samplers,
+ &brw_hs_samplers,
+ &brw_ds_samplers,
&brw_gs_samplers,
&gen8_multisample_state,