radeonsi: set number of userdata SGPRs of GS copy shader to 4

It only needs the constant buffer with clip planes and read-write resources
for the GS->VS ring and streamout. That's 2 pointers.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
Marek Olšák 2014-09-23 19:42:28 +02:00
parent 68d36c0bb5
commit 1f6c0b55df
3 changed files with 23 additions and 10 deletions

View file

@ -2402,8 +2402,8 @@ static void create_function(struct si_shader_context *si_shader_ctx)
v8i32 = LLVMVectorType(i32, 8);
v16i8 = LLVMVectorType(i8, 16);
params[SI_PARAM_CONST] = const_array(v16i8, SI_NUM_CONST_BUFFERS);
params[SI_PARAM_RW_BUFFERS] = const_array(v16i8, SI_NUM_RW_BUFFERS);
params[SI_PARAM_CONST] = const_array(v16i8, SI_NUM_CONST_BUFFERS);
params[SI_PARAM_SAMPLER] = const_array(v4i32, SI_NUM_SAMPLER_STATES);
params[SI_PARAM_RESOURCE] = const_array(v8i32, SI_NUM_SAMPLER_VIEWS);
last_array_pointer = SI_PARAM_RESOURCE;
@ -2415,10 +2415,16 @@ static void create_function(struct si_shader_context *si_shader_ctx)
params[SI_PARAM_BASE_VERTEX] = i32;
params[SI_PARAM_START_INSTANCE] = i32;
num_params = SI_PARAM_START_INSTANCE+1;
if (shader->key.vs.as_es) {
params[SI_PARAM_ES2GS_OFFSET] = i32;
num_params++;
} else {
if (shader->is_gs_copy_shader) {
last_array_pointer = SI_PARAM_CONST;
num_params = SI_PARAM_CONST+1;
}
/* The locations of the other parameters are assigned dynamically. */
/* Streamout SGPRs. */
@ -2716,6 +2722,7 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
outputs = MALLOC(gs->noutput * sizeof(outputs[0]));
si_shader_ctx->type = TGSI_PROCESSOR_VERTEX;
shader->is_gs_copy_shader = true;
radeon_llvm_context_init(&si_shader_ctx->radeon_bld);

View file

@ -33,10 +33,10 @@
#include "tgsi/tgsi_scan.h"
#include "si_state.h"
#define SI_SGPR_CONST 0
#define SI_SGPR_SAMPLER 2
#define SI_SGPR_RESOURCE 4
#define SI_SGPR_RW_BUFFERS 6 /* rings (& stream-out, VS only) */
#define SI_SGPR_RW_BUFFERS 0 /* rings (& stream-out, VS only) */
#define SI_SGPR_CONST 2
#define SI_SGPR_SAMPLER 4
#define SI_SGPR_RESOURCE 6
#define SI_SGPR_VERTEX_BUFFER 8 /* VS only */
#define SI_SGPR_BASE_VERTEX 10 /* VS only */
#define SI_SGPR_START_INSTANCE 11 /* VS only */
@ -44,13 +44,14 @@
#define SI_VS_NUM_USER_SGPR 12
#define SI_GS_NUM_USER_SGPR 8
#define SI_GSCOPY_NUM_USER_SGPR 4
#define SI_PS_NUM_USER_SGPR 9
/* LLVM function parameter indices */
#define SI_PARAM_CONST 0
#define SI_PARAM_SAMPLER 1
#define SI_PARAM_RESOURCE 2
#define SI_PARAM_RW_BUFFERS 3
#define SI_PARAM_RW_BUFFERS 0
#define SI_PARAM_CONST 1
#define SI_PARAM_SAMPLER 2
#define SI_PARAM_RESOURCE 3
/* VS only parameters */
#define SI_PARAM_VERTEX_BUFFER 4
@ -183,6 +184,7 @@ struct si_shader {
bool vs_out_layer;
unsigned nr_pos_exports;
unsigned clip_dist_write;
bool is_gs_copy_shader;
};
static inline struct si_shader* si_get_vs_state(struct si_context *sctx)

View file

@ -166,7 +166,11 @@ static void si_shader_vs(struct pipe_context *ctx, struct si_shader *shader)
vgpr_comp_cnt = shader->uses_instanceid ? 3 : 0;
num_user_sgprs = SI_VS_NUM_USER_SGPR;
if (shader->is_gs_copy_shader)
num_user_sgprs = SI_GSCOPY_NUM_USER_SGPR;
else
num_user_sgprs = SI_VS_NUM_USER_SGPR;
num_sgprs = shader->num_sgprs;
if (num_user_sgprs > num_sgprs) {
/* Last 2 reserved SGPRs are used for VCC */