aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_tcs.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-28 16:25:31 -0700
committerJason Ekstrand <[email protected]>2017-10-12 22:39:29 -0700
commit2975e4c56a7aeade5a324aa4d446f18cc176fa06 (patch)
treef08787f03d0781b1d7823095acabf3e86d5522ec /src/mesa/drivers/dri/i965/brw_tcs.c
parentfaad828b16448c1008a1b15ac8d8a72b13005c09 (diff)
intel: Rewrite the world of push/pull params
This moves us away to the array of pointers model and onto a model where each param is represented by a generic uint32_t handle. We reserve 2^16 of these handles for builtins that get generated by somewhere inside the compiler and have well-defined meanings. Generic params have handles whose meanings are defined by the driver. The primary downside to this new approach is that it moves a little bit of the work that we would normally do at compile time to draw time. On my laptop this hurts OglBatch6 by no more than 1% and doesn't seem to have any measurable affect on OglBatch7. So, while this may come back to bite us, it doesn't look too bad. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_tcs.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 474787b0ea6..272545453a4 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -188,10 +188,8 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp,
*/
int param_count = nir->num_uniforms / 4;
- prog_data.base.base.param =
- rzalloc_array(NULL, const gl_constant_value *, param_count);
- prog_data.base.base.pull_param =
- rzalloc_array(NULL, const gl_constant_value *, param_count);
+ prog_data.base.base.param = rzalloc_array(NULL, uint32_t, param_count);
+ prog_data.base.base.pull_param = rzalloc_array(NULL, uint32_t, param_count);
prog_data.base.base.nr_params = param_count;
if (tcp) {
@@ -211,26 +209,25 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp,
/* Upload the Patch URB Header as the first two uniforms.
* Do the annoying scrambling so the shader doesn't have to.
*/
- const float **param = (const float **) prog_data.base.base.param;
- static float zero = 0.0f;
+ uint32_t *param = prog_data.base.base.param;
for (int i = 0; i < 8; i++)
- param[i] = &zero;
+ param[i] = BRW_PARAM_BUILTIN_ZERO;
if (key->tes_primitive_mode == GL_QUADS) {
for (int i = 0; i < 4; i++)
- param[7 - i] = &ctx->TessCtrlProgram.patch_default_outer_level[i];
+ param[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
- param[3] = &ctx->TessCtrlProgram.patch_default_inner_level[0];
- param[2] = &ctx->TessCtrlProgram.patch_default_inner_level[1];
+ param[3] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
+ param[2] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y;
} else if (key->tes_primitive_mode == GL_TRIANGLES) {
for (int i = 0; i < 3; i++)
- param[7 - i] = &ctx->TessCtrlProgram.patch_default_outer_level[i];
+ param[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i;
- param[4] = &ctx->TessCtrlProgram.patch_default_inner_level[0];
+ param[4] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X;
} else {
assert(key->tes_primitive_mode == GL_ISOLINES);
- param[7] = &ctx->TessCtrlProgram.patch_default_outer_level[1];
- param[6] = &ctx->TessCtrlProgram.patch_default_outer_level[0];
+ param[7] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_Y;
+ param[6] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X;
}
}