diff options
author | Kenneth Graunke <[email protected]> | 2015-11-25 23:35:29 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-12-22 02:12:05 -0800 |
commit | 57f7c85dcf8ca8b47b71076fb70d9242aec00588 (patch) | |
tree | 2e00baac21ab8570a77a1f1abe7865c56433d68a /src/mesa/drivers/dri/i965/brw_tcs.c | |
parent | 24be658d13b13fdb8a1977208038b4ba43bce4ac (diff) |
i965: Implement gl_PatchVerticesIn by baking it into brw_tcs_prog_key.
The hardware provides us no decent way of getting at the number of input
vertices in the patch topology from the tessellation control shader.
It's actually very surprising - normally this sort of information would
be available in the thread payload.
For the precompile, we guess that the number of vertices will be the
same for both the input and output patches. This usually seems to be
the case.
On Gen8+, we could pass in an extra push constant containing this value.
We may be able to do that on Haswell too. It's quite a bit trickier on
Ivybridge, however.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_tcs.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tcs.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index b33a16d1710..b5eb4cdde5e 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -65,6 +65,8 @@ brw_tcs_debug_recompile(struct brw_context *brw, return; } + found |= key_debug(brw, "input vertices", old_key->input_vertices, + key->input_vertices); found |= key_debug(brw, "TES primitive mode", old_key->tes_primitive_mode, key->tes_primitive_mode); found |= brw_debug_recompile_sampler_key(brw, &old_key->tex, &key->tex); @@ -188,6 +190,7 @@ brw_upload_tcs_prog(struct brw_context *brw) if (!brw_state_dirty(brw, _NEW_TEXTURE, + BRW_NEW_PATCH_PRIMITIVE | BRW_NEW_TESS_CTRL_PROGRAM | BRW_NEW_TESS_EVAL_PROGRAM)) return; @@ -207,6 +210,8 @@ brw_upload_tcs_prog(struct brw_context *brw) key.program_string_id = tcp->id; + key.input_vertices = ctx->TessCtrlProgram.patch_vertices; + /* _NEW_TEXTURE */ brw_populate_sampler_prog_key_data(ctx, prog, stage_state->sampler_count, &key.tex); @@ -251,6 +256,9 @@ brw_tcs_precompile(struct gl_context *ctx, key.program_string_id = btcp->id; brw_setup_tex_for_precompile(brw, &key.tex, prog); + /* Guess that the input and output patches have the same dimensionality. */ + key.input_vertices = shader_prog->TessCtrl.VerticesOut; + key.tes_primitive_mode = GL_TRIANGLES; success = brw_codegen_tcs_prog(brw, shader_prog, btcp, &key); |