diff options
author | Marek Olšák <[email protected]> | 2016-04-19 02:09:55 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-04-22 01:14:14 +0200 |
commit | 3138a28ff2a6a7c9bbf315538412f84b549d694a (patch) | |
tree | 059aae9db21af767a6c64c225a31f5a773c7f2c9 | |
parent | 302bec24bd67cb21c39e9db872afe946994547a7 (diff) |
radeonsi: move default tess level constant buffer to RW buffers
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 19 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 15 |
5 files changed, 35 insertions, 10 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 57bc7d3eb8a..e6a4f3d28e3 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1280,6 +1280,25 @@ static void declare_system_value( break; } + case TGSI_SEMANTIC_DEFAULT_TESSOUTER_SI: + case TGSI_SEMANTIC_DEFAULT_TESSINNER_SI: + { + LLVMValueRef buf, slot, val[4]; + int i, offset; + + slot = lp_build_const_int32(gallivm, SI_HS_CONST_DEFAULT_TESS_LEVELS); + buf = LLVMGetParam(ctx->radeon_bld.main_fn, SI_PARAM_RW_BUFFERS); + buf = build_indexed_load_const(ctx, buf, slot); + offset = decl->Semantic.Name == TGSI_SEMANTIC_DEFAULT_TESSINNER_SI ? 4 : 0; + + for (i = 0; i < 4; i++) + val[i] = buffer_load_const(gallivm->builder, buf, + lp_build_const_int32(gallivm, (offset + i) * 4), + ctx->f32); + value = lp_build_gather_values(gallivm, val, 4); + break; + } + case TGSI_SEMANTIC_PRIMID: value = get_primitive_id(&radeon_bld->soa.bld_base, 0); break; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 857a6829e01..0470890be7f 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -210,6 +210,12 @@ enum { SI_NUM_PARAMS = SI_PARAM_POS_FIXED_PT + 9, /* +8 for COLOR[0..1] */ }; +/* SI-specific system values. */ +enum { + TGSI_SEMANTIC_DEFAULT_TESSOUTER_SI = TGSI_SEMANTIC_COUNT, + TGSI_SEMANTIC_DEFAULT_TESSINNER_SI, +}; + struct si_shader; /* A shader selector is a gallium CSO and contains shader variants and diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 2e488fe089e..3f74176d041 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -3395,8 +3395,8 @@ static void si_set_tess_state(struct pipe_context *ctx, (void*)array, sizeof(array), &cb.buffer_offset); - ctx->set_constant_buffer(ctx, PIPE_SHADER_TESS_CTRL, - SI_DRIVER_STATE_CONST_BUF, &cb); + si_set_constant_buffer(sctx, &sctx->rw_buffers, + SI_HS_CONST_DEFAULT_TESS_LEVELS, &cb); pipe_resource_reference(&cb.buffer, NULL); } diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 2b566bf25a0..80a5983f2ef 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -178,6 +178,7 @@ enum { SI_VS_STREAMOUT_BUF2, SI_VS_STREAMOUT_BUF3, + SI_HS_CONST_DEFAULT_TESS_LEVELS, SI_VS_CONST_CLIP_PLANES, SI_PS_CONST_POLY_STIPPLE, SI_PS_CONST_SAMPLE_POSITIONS, diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 5c923cb80c1..d02ce8f74dd 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1804,7 +1804,7 @@ static void si_init_tess_factor_ring(struct si_context *sctx) */ static void si_generate_fixed_func_tcs(struct si_context *sctx) { - struct ureg_src const0, const1; + struct ureg_src outer, inner; struct ureg_dst tessouter, tessinner; struct ureg_program *ureg = ureg_create(TGSI_PROCESSOR_TESS_CTRL); @@ -1813,17 +1813,16 @@ static void si_generate_fixed_func_tcs(struct si_context *sctx) assert(!sctx->fixed_func_tcs_shader.cso); - ureg_DECL_constant2D(ureg, 0, 1, SI_DRIVER_STATE_CONST_BUF); - const0 = ureg_src_dimension(ureg_src_register(TGSI_FILE_CONSTANT, 0), - SI_DRIVER_STATE_CONST_BUF); - const1 = ureg_src_dimension(ureg_src_register(TGSI_FILE_CONSTANT, 1), - SI_DRIVER_STATE_CONST_BUF); + outer = ureg_DECL_system_value(ureg, + TGSI_SEMANTIC_DEFAULT_TESSOUTER_SI, 0); + inner = ureg_DECL_system_value(ureg, + TGSI_SEMANTIC_DEFAULT_TESSINNER_SI, 0); tessouter = ureg_DECL_output(ureg, TGSI_SEMANTIC_TESSOUTER, 0); tessinner = ureg_DECL_output(ureg, TGSI_SEMANTIC_TESSINNER, 0); - ureg_MOV(ureg, tessouter, const0); - ureg_MOV(ureg, tessinner, const1); + ureg_MOV(ureg, tessouter, outer); + ureg_MOV(ureg, tessinner, inner); ureg_END(ureg); sctx->fixed_func_tcs_shader.cso = |