radeonsi: make ES2GS offset sgpr location dynamic
authorMarek Olšák <marek.olsak@amd.com>
Sun, 5 Oct 2014 22:17:42 +0000 (00:17 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Jul 2015 22:59:31 +0000 (00:59 +0200)
It will have a different location in the tessellation evaluation shader.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h

index 955e780faf2b67f85b262ed74817b1aa4181bd43..d0e7fa95cf7d61353c3444d5f85c8473faface95 100644 (file)
@@ -72,6 +72,7 @@ struct si_shader_context
        int param_streamout_offset[4];
        int param_vertex_id;
        int param_instance_id;
+       int param_es2gs_offset;
        LLVMTargetMachineRef tm;
        LLVMValueRef const_md;
        LLVMValueRef const_resource[SI_NUM_CONST_BUFFERS];
@@ -1332,7 +1333,7 @@ static void si_llvm_emit_es_epilogue(struct lp_build_tgsi_context * bld_base)
        struct tgsi_shader_info *info = &es->selector->info;
        LLVMTypeRef i32 = LLVMInt32TypeInContext(gallivm->context);
        LLVMValueRef soffset = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn,
-                                           SI_PARAM_ES2GS_OFFSET);
+                                           si_shader_ctx->param_es2gs_offset);
        unsigned chan;
        int i;
 
@@ -2385,8 +2386,7 @@ static void create_function(struct si_shader_context *si_shader_ctx)
                num_params = SI_PARAM_START_INSTANCE+1;
 
                if (shader->key.vs.as_es) {
-                       params[SI_PARAM_ES2GS_OFFSET] = i32;
-                       num_params++;
+                       params[si_shader_ctx->param_es2gs_offset = num_params++] = i32;
                } else {
                        if (shader->is_gs_copy_shader) {
                                last_array_pointer = SI_PARAM_CONST;
index c12782f288cb20436f2475f61287125392668a1a..be3e98a361a33a55d49996198c587e45fe904c5f 100644 (file)
@@ -62,9 +62,6 @@ struct radeon_shader_reloc;
 #define SI_PARAM_START_INSTANCE        6
 /* the other VS parameters are assigned dynamically */
 
-/* ES only parameters */
-#define SI_PARAM_ES2GS_OFFSET  7
-
 /* GS only parameters */
 #define SI_PARAM_GS2VS_OFFSET  4
 #define SI_PARAM_GS_WAVE_ID    5