diff options
author | Kenneth Graunke <[email protected]> | 2019-03-06 20:56:37 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-03-11 14:07:12 -0700 |
commit | 2f51cb5e67524d55508ec7bc1ee2a9d4d1087291 (patch) | |
tree | 1e67c4d60e4fda0008ea126723d140f0dd708226 /src/gallium/drivers/iris/iris_program.c | |
parent | fd5075e0594ba13c24eb195e098a814c8e76249b (diff) |
iris: Rework default tessellation level uploads
Now that we've added a system value uploading mechanism, we may as well
reuse the same system for default tessellation levels. This simplifies
the state upload code a bit.
Also fixes:
KHR-GL45.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_tessLevel
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_program.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_program.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 9d1664029d9..279dbc3a943 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -727,8 +727,29 @@ iris_compile_tcs(struct iris_context *ice, nir = brw_nir_create_passthrough_tcs(mem_ctx, compiler, options, key); /* Reserve space for passing the default tess levels as constants. */ - prog_data->param = rzalloc_array(mem_ctx, uint32_t, 8); - prog_data->nr_params = 8; + num_system_values = 8; + system_values = + rzalloc_array(mem_ctx, enum brw_param_builtin, num_system_values); + prog_data->param = rzalloc_array(mem_ctx, uint32_t, num_system_values); + prog_data->nr_params = num_system_values; + + if (key->tes_primitive_mode == GL_QUADS) { + for (int i = 0; i < 4; i++) + system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i; + + system_values[3] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X; + system_values[2] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y; + } else if (key->tes_primitive_mode == GL_TRIANGLES) { + for (int i = 0; i < 3; i++) + system_values[7 - i] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X + i; + + system_values[4] = BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X; + } else { + assert(key->tes_primitive_mode == GL_ISOLINES); + system_values[7] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_Y; + system_values[6] = BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X; + } + prog_data->ubo_ranges[0].length = 1; } |