From: Marek Olšák Date: Tue, 19 Apr 2016 00:09:55 +0000 (+0200) Subject: radeonsi: move default tess level constant buffer to RW buffers X-Git-Tag: upstream/17.1.0~10789 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3138a28ff2a6a7c9bbf315538412f84b549d694a;p=platform%2Fupstream%2Fmesa.git radeonsi: move default tess level constant buffer to RW buffers Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 57bc7d3..e6a4f3d 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 857a682..0470890 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 2e488fe..3f74176 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 2b566bf..80a5983 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 5c923cb..d02ce8f 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 =