<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Apr 27, 2017 10:50 AM, "Juan A. Suarez Romero" <<a href="mailto:jasuarez@igalia.com">jasuarez@igalia.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text">On Wed, 2017-04-26 at 09:12 +1000, Dave Airlie wrote:<br>
> From: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
><br>
> This code can be shared by radv, we bump the max to<br>
> VARYING_SLOT_MAX here, but that shouldn't have too<br>
> much fallout.<br>
><br>
> Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
> ---<br>
> src/amd/common/ac_exp_param.h | 40 ++++++<br>
> src/amd/common/ac_llvm_build.c | 156 +++++++++++++++++++++++-<br>
> src/amd/common/ac_llvm_build.h | 6 +<br>
> src/amd/common/ac_llvm_helper.<wbr>cpp | 20 +++<br>
> src/amd/common/ac_llvm_util.h | 2 +<br>
> src/gallium/drivers/radeonsi/<wbr>si_shader.c | 152 ++---------------------<br>
> src/gallium/drivers/radeonsi/<wbr>si_shader.h | 12 --<br>
> src/gallium/drivers/radeonsi/<wbr>si_state_shaders.c | 13 +-<br>
> 8 files changed, 237 insertions(+), 164 deletions(-)<br>
> create mode 100644 src/amd/common/ac_exp_param.h<br>
><br>
> diff --git a/src/amd/common/ac_exp_param.<wbr>h b/src/amd/common/ac_exp_param.<wbr>h<br>
> new file mode 100644<br>
> index 0000000..b97ce81<br>
> --- /dev/null<br>
> +++ b/src/amd/common/ac_exp_param.<wbr>h<br>
> @@ -0,0 +1,40 @@<br>
> +/*<br>
> + * Copyright 2014 Advanced Micro Devices, Inc.<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
> + * copy of this software and associated documentation files (the<br>
> + * "Software"), to deal in the Software without restriction, including<br>
> + * without limitation the rights to use, copy, modify, merge, publish,<br>
> + * distribute, sub license, and/or sell copies of the Software, and to<br>
> + * permit persons to whom the Software is furnished to do so, subject to<br>
> + * the following conditions:<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL<br>
> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,<br>
> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR<br>
> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE<br>
> + * USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
> + *<br>
> + * The above copyright notice and this permission notice (including the<br>
> + * next paragraph) shall be included in all copies or substantial portions<br>
> + * of the Software.<br>
> + *<br>
> + */<br>
> +#ifndef AC_EXP_PARAM_H<br>
> +#define AC_EXP_PARAM_H<br>
> +<br>
> +enum {<br>
> + /* SPI_PS_INPUT_CNTL_i.OFFSET[0:<wbr>4] */<br>
> + AC_EXP_PARAM_OFFSET_0 = 0,<br>
> + AC_EXP_PARAM_OFFSET_31 = 31,<br>
> + /* SPI_PS_INPUT_CNTL_i.DEFAULT_<wbr>VAL[0:1] */<br>
> + AC_EXP_PARAM_DEFAULT_VAL_0000 = 64,<br>
> + AC_EXP_PARAM_DEFAULT_VAL_0001,<br>
> + AC_EXP_PARAM_DEFAULT_VAL_1110,<br>
> + AC_EXP_PARAM_DEFAULT_VAL_1111,<br>
> + AC_EXP_PARAM_UNDEFINED = 255,<br>
> +};<br>
> +<br>
> +#endif<br>
> diff --git a/src/amd/common/ac_llvm_<wbr>build.c b/src/amd/common/ac_llvm_<wbr>build.c<br>
> index d45094c..f452f3e 100644<br>
> --- a/src/amd/common/ac_llvm_<wbr>build.c<br>
> +++ b/src/amd/common/ac_llvm_<wbr>build.c<br>
> @@ -33,11 +33,13 @@<br>
> #include <stdio.h><br>
><br>
> #include "ac_llvm_util.h"<br>
> -<br>
> +#include "ac_exp_param.h"<br>
> #include "util/bitscan.h"<br>
> #include "util/macros.h"<br>
> #include "sid.h"<br>
><br>
> +#include "shader_enums.h"<br>
> +<br>
> /* Initialize module-independent parts of the context.<br>
> *<br>
> * The caller is responsible for initializing ctx::module and ctx::builder.<br>
> @@ -1244,3 +1246,155 @@ void ac_get_image_intr_name(const char *base_name,<br>
> data_type_name, coords_type_name, rsrc_type_name);<br>
> }<br>
> }<br>
> +<br>
> +#define AC_EXP_TARGET (HAVE_LLVM >= 0x0500 ? 0 : 3)<br>
> +#define AC_EXP_OUT0 (HAVE_LLVM >= 0x0500 ? 2 : 5)<br>
> +<br>
> +/* Return true if the PARAM export has been eliminated. */<br>
> +static bool ac_eliminate_const_output(<wbr>uint8_t *vs_output_param_offset,<br>
> + uint32_t num_outputs,<br>
> + LLVMValueRef inst, unsigned offset)<br>
> +{<br>
> + unsigned i, default_val; /* SPI_PS_INPUT_CNTL_i.DEFAULT_<wbr>VAL */<br>
> + bool is_zero[4] = {}, is_one[4] = {};<br>
> +<br>
> + for (i = 0; i < 4; i++) {<br>
> + LLVMBool loses_info;<br>
> + LLVMValueRef p = LLVMGetOperand(inst, AC_EXP_OUT0 + i);<br>
> +<br>
> + /* It's a constant expression. Undef outputs are eliminated too. */<br>
> + if (LLVMIsUndef(p)) {<br>
> + is_zero[i] = true;<br>
> + is_one[i] = true;<br>
> + } else if (LLVMIsAConstantFP(p)) {<br>
> + double a = LLVMConstRealGetDouble(p, &loses_info);<br>
> +<br>
> + if (a == 0)<br>
> + is_zero[i] = true;<br>
> + else if (a == 1)<br>
> + is_one[i] = true;<br>
> + else<br>
> + return false; /* other constant */<br>
> + } else<br>
> + return false;<br>
> + }<br>
> +<br>
> + /* Only certain combinations of 0 and 1 can be eliminated. */<br>
> + if (is_zero[0] && is_zero[1] && is_zero[2])<br>
> + default_val = is_zero[3] ? 0 : 1;<br>
> + else if (is_one[0] && is_one[1] && is_one[2])<br>
> + default_val = is_zero[3] ? 2 : 3;<br>
> + else<br>
> + return false;<br>
> +<br>
> + /* The PARAM export can be represented as DEFAULT_VAL. Kill it. */<br>
> + LLVMInstructionEraseFromParent<wbr>(inst);<br>
> +<br>
> + /* Change OFFSET to DEFAULT_VAL. */<br>
> + for (i = 0; i < num_outputs; i++) {<br>
> + if (vs_output_param_offset[i] == offset) {<br>
> + vs_output_param_offset[i] =<br>
> + AC_EXP_PARAM_DEFAULT_VAL_0000 + default_val;<br>
> + break;<br>
> + }<br>
> + }<br>
> + return true;<br>
> +}<br>
> +<br>
> +struct ac_vs_exports {<br>
> + unsigned num;<br>
> + unsigned offset[VARYING_SLOT_MAX];<br>
> + LLVMValueRef inst[VARYING_SLOT_MAX];<br>
> +};<br>
> +<br>
> +void ac_eliminate_const_vs_outputs(<wbr>struct ac_llvm_context *ctx,<br>
> + LLVMValueRef main_fn,<br>
> + uint8_t *vs_output_param_offset,<br>
> + uint32_t num_outputs,<br>
> + uint8_t *num_param_exports)<br>
> +{<br>
> + LLVMBasicBlockRef bb;<br>
> + bool removed_any = false;<br>
> + struct ac_vs_exports exports;<br>
> +<br>
> + assert(num_outputs < VARYING_SLOT_MAX);<br>
> + exports.num = 0;<br>
> +<br>
> + /* Process all LLVM instructions. */<br>
> + bb = LLVMGetFirstBasicBlock(main_<wbr>fn);<br>
> + while (bb) {<br>
> + LLVMValueRef inst = LLVMGetFirstInstruction(bb);<br>
> +<br>
> + while (inst) {<br>
> + LLVMValueRef cur = inst;<br>
> + inst = LLVMGetNextInstruction(inst);<br>
> +<br>
> + if (LLVMGetInstructionOpcode(cur) != LLVMCall)<br>
> + continue;<br>
> +<br>
> + LLVMValueRef callee = ac_llvm_get_called_value(cur);<br>
> +<br>
> + if (!ac_llvm_is_function(callee))<br>
> + continue;<br>
> +<br>
> + const char *name = LLVMGetValueName(callee);<br>
> + unsigned num_args = LLVMCountParams(callee);<br>
> +<br>
> + /* Check if this is an export instruction. */<br>
> + if ((num_args != 9 && num_args != 8) ||<br>
> + (strcmp(name, "llvm.SI.export") &&<br>
> + strcmp(name, "llvm.amdgcn.exp.f32")))<br>
> + continue;<br>
> +<br>
> + LLVMValueRef arg = LLVMGetOperand(cur, AC_EXP_TARGET);<br>
> + unsigned target = LLVMConstIntGetZExtValue(arg);<br>
> +<br>
> + if (target < V_008DFC_SQ_EXP_PARAM)<br>
> + continue;<br>
> +<br>
> + target -= V_008DFC_SQ_EXP_PARAM;<br>
> +<br>
> + /* Eliminate constant value PARAM exports. */<br>
> + if (ac_eliminate_const_output(vs_<wbr>output_param_offset,<br>
> + num_outputs, cur, target)) {<br>
> + removed_any = true;<br>
> + } else {<br>
> + exports.offset[exports.num] = target;<br>
> + exports.inst[exports.num] = cur;<br>
> + exports.num++;<br>
> + }<br>
> + }<br>
> + bb = LLVMGetNextBasicBlock(bb);<br>
> + }<br>
> +<br>
> + /* Remove holes in export memory due to removed PARAM exports.<br>
> + * This is done by renumbering all PARAM exports.<br>
> + */<br>
> + if (removed_any) {<br>
> + uint8_t current_offset[VARYING_SLOT_<wbr>MAX];<br>
> + unsigned new_count = 0;<br>
> + unsigned out, i;<br>
> +<br>
> + /* Make a copy of the offsets. We need the old version while<br>
> + * we are modifying some of them. */<br>
> + memcpy(current_offset, vs_output_param_offset,<br>
> + sizeof(current_offset));<br>
> +<br>
> + for (i = 0; i < exports.num; i++) {<br>
> + unsigned offset = exports.offset[i];<br>
> +<br>
> + for (out = 0; out < num_outputs; out++) {<br>
> + if (current_offset[out] != offset)<br>
> + continue;<br>
> +<br>
> + LLVMSetOperand(exports.inst[i]<wbr>, AC_EXP_TARGET,<br>
> + LLVMConstInt(ctx->i32,<br>
> + V_008DFC_SQ_EXP_PARAM + new_count, 0));<br>
> + vs_output_param_offset[out] = new_count;<br>
> + new_count++;<br>
> + break;<br>
> + }<br>
> + }<br>
> + *num_param_exports = new_count;<br>
> + }<br>
> +}<br>
> diff --git a/src/amd/common/ac_llvm_<wbr>build.h b/src/amd/common/ac_llvm_<wbr>build.h<br>
> index d6edcde..1c3610a 100644<br>
> --- a/src/amd/common/ac_llvm_<wbr>build.h<br>
> +++ b/src/amd/common/ac_llvm_<wbr>build.h<br>
> @@ -239,6 +239,12 @@ void ac_get_image_intr_name(const char *base_name,<br>
> LLVMTypeRef coords_type,<br>
> LLVMTypeRef rsrc_type,<br>
> char *out_name, unsigned out_len);<br>
> +<br>
> +void ac_eliminate_const_vs_outputs(<wbr>struct ac_llvm_context *ac,<br>
> + LLVMValueRef main_fn,<br>
> + uint8_t *vs_output_param_offset,<br>
> + uint32_t num_outputs,<br>
> + uint8_t *num_param_exports);<br>
> #ifdef __cplusplus<br>
> }<br>
> #endif<br>
> diff --git a/src/amd/common/ac_llvm_<wbr>helper.cpp b/src/amd/common/ac_llvm_<wbr>helper.cpp<br>
> index 11fa809..582a8f7 100644<br>
> --- a/src/amd/common/ac_llvm_<wbr>helper.cpp<br>
> +++ b/src/amd/common/ac_llvm_<wbr>helper.cpp<br>
> @@ -61,3 +61,23 @@ bool ac_is_sgpr_param(LLVMValueRef arg)<br>
> return AS.hasAttribute(ArgNo + 1, llvm::Attribute::ByVal) ||<br>
> AS.hasAttribute(ArgNo + 1, llvm::Attribute::InReg);<br>
> }<br>
> +<br>
> +LLVMValueRef ac_llvm_get_called_value(<wbr>LLVMValueRef call)<br>
> +{<br>
> +#if HAVE_LLVM >= 0x0309<br>
> + return LLVMGetCalledValue(call);<br>
> +#elif HAVE_LLVM >= 0x0305<br>
> + return llvm::wrap(llvm::CallSite(<wbr>llvm::unwrap<llvm::<wbr>Instruction>(call)).<wbr>getCalledValue());<br>
<br>
<br>
</div>This patch is breaking build when using LLVM 3.8.1.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Can you share the build error with us?</div><div dir="auto"><br></div><div dir="auto">BTW, I have a patch that removes support for LLVM 3.8.</div><div dir="auto"><br></div><div dir="auto">Marek</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="elided-text"><br>
<br>
<br>
> +#else<br>
> + return NULL; /* radeonsi doesn't support so old LLVM. */<br>
> +#endif<br>
> +}<br>
> +<br>
> +bool ac_llvm_is_function(<wbr>LLVMValueRef v)<br>
> +{<br>
> +#if HAVE_LLVM >= 0x0309<br>
> + return LLVMGetValueKind(v) == LLVMFunctionValueKind;<br>
> +#else<br>
> + return llvm::isa<llvm::Function>(<wbr>llvm::unwrap(v));<br>
> +#endif<br>
> +}<br>
> diff --git a/src/amd/common/ac_llvm_util.<wbr>h b/src/amd/common/ac_llvm_util.<wbr>h<br>
> index faecf1e..38e7dde 100644<br>
> --- a/src/amd/common/ac_llvm_util.<wbr>h<br>
> +++ b/src/amd/common/ac_llvm_util.<wbr>h<br>
> @@ -64,6 +64,8 @@ void ac_add_func_attributes(<wbr>LLVMContextRef ctx, LLVMValueRef function,<br>
> unsigned attrib_mask);<br>
> void ac_dump_module(LLVMModuleRef module);<br>
><br>
> +LLVMValueRef ac_llvm_get_called_value(<wbr>LLVMValueRef call);<br>
> +bool ac_llvm_is_function(<wbr>LLVMValueRef v);<br>
> #ifdef __cplusplus<br>
> }<br>
> #endif<br>
> diff --git a/src/gallium/drivers/<wbr>radeonsi/si_shader.c b/src/gallium/drivers/<wbr>radeonsi/si_shader.c<br>
> index 5d7175d..27d88b1 100644<br>
> --- a/src/gallium/drivers/<wbr>radeonsi/si_shader.c<br>
> +++ b/src/gallium/drivers/<wbr>radeonsi/si_shader.c<br>
> @@ -41,6 +41,7 @@<br>
><br>
> #include "ac_binary.h"<br>
> #include "ac_llvm_util.h"<br>
> +#include "ac_exp_param.h"<br>
> #include "si_shader_internal.h"<br>
> #include "si_pipe.h"<br>
> #include "sid.h"<br>
> @@ -6793,76 +6794,10 @@ static void si_init_shader_ctx(struct si_shader_context *ctx,<br>
> bld_base->op_actions[TGSI_<wbr>OPCODE_BARRIER].emit = si_llvm_emit_barrier;<br>
> }<br>
><br>
> -#define EXP_TARGET (HAVE_LLVM >= 0x0500 ? 0 : 3)<br>
> -#define EXP_OUT0 (HAVE_LLVM >= 0x0500 ? 2 : 5)<br>
> -<br>
> -/* Return true if the PARAM export has been eliminated. */<br>
> -static bool si_eliminate_const_output(<wbr>struct si_shader_context *ctx,<br>
> - LLVMValueRef inst, unsigned offset)<br>
> -{<br>
> - struct si_shader *shader = ctx->shader;<br>
> - unsigned num_outputs = shader->selector->info.num_<wbr>outputs;<br>
> - unsigned i, default_val; /* SPI_PS_INPUT_CNTL_i.DEFAULT_<wbr>VAL */<br>
> - bool is_zero[4] = {}, is_one[4] = {};<br>
> -<br>
> - for (i = 0; i < 4; i++) {<br>
> - LLVMBool loses_info;<br>
> - LLVMValueRef p = LLVMGetOperand(inst, EXP_OUT0 + i);<br>
> -<br>
> - /* It's a constant expression. Undef outputs are eliminated too. */<br>
> - if (LLVMIsUndef(p)) {<br>
> - is_zero[i] = true;<br>
> - is_one[i] = true;<br>
> - } else if (LLVMIsAConstantFP(p)) {<br>
> - double a = LLVMConstRealGetDouble(p, &loses_info);<br>
> -<br>
> - if (a == 0)<br>
> - is_zero[i] = true;<br>
> - else if (a == 1)<br>
> - is_one[i] = true;<br>
> - else<br>
> - return false; /* other constant */<br>
> - } else<br>
> - return false;<br>
> - }<br>
> -<br>
> - /* Only certain combinations of 0 and 1 can be eliminated. */<br>
> - if (is_zero[0] && is_zero[1] && is_zero[2])<br>
> - default_val = is_zero[3] ? 0 : 1;<br>
> - else if (is_one[0] && is_one[1] && is_one[2])<br>
> - default_val = is_zero[3] ? 2 : 3;<br>
> - else<br>
> - return false;<br>
> -<br>
> - /* The PARAM export can be represented as DEFAULT_VAL. Kill it. */<br>
> - LLVMInstructionEraseFromParent<wbr>(inst);<br>
> -<br>
> - /* Change OFFSET to DEFAULT_VAL. */<br>
> - for (i = 0; i < num_outputs; i++) {<br>
> - if (shader->info.vs_output_param_<wbr>offset[i] == offset) {<br>
> - shader->info.vs_output_param_<wbr>offset[i] =<br>
> - EXP_PARAM_DEFAULT_VAL_0000 + default_val;<br>
> - break;<br>
> - }<br>
> - }<br>
> - return true;<br>
> -}<br>
> -<br>
> -struct si_vs_exports {<br>
> - unsigned num;<br>
> - unsigned offset[SI_MAX_VS_OUTPUTS];<br>
> - LLVMValueRef inst[SI_MAX_VS_OUTPUTS];<br>
> -};<br>
> -<br>
> static void si_eliminate_const_vs_outputs(<wbr>struct si_shader_context *ctx)<br>
> {<br>
> struct si_shader *shader = ctx->shader;<br>
> struct tgsi_shader_info *info = &shader->selector->info;<br>
> - LLVMBasicBlockRef bb;<br>
> - struct si_vs_exports exports;<br>
> - bool removed_any = false;<br>
> -<br>
> - exports.num = 0;<br>
><br>
> if (ctx->type == PIPE_SHADER_FRAGMENT ||<br>
> ctx->type == PIPE_SHADER_COMPUTE ||<br>
> @@ -6870,84 +6805,11 @@ static void si_eliminate_const_vs_outputs(<wbr>struct si_shader_context *ctx)<br>
> shader->key.as_ls)<br>
> return;<br>
><br>
> - /* Process all LLVM instructions. */<br>
> - bb = LLVMGetFirstBasicBlock(ctx-><wbr>main_fn);<br>
> - while (bb) {<br>
> - LLVMValueRef inst = LLVMGetFirstInstruction(bb);<br>
> -<br>
> - while (inst) {<br>
> - LLVMValueRef cur = inst;<br>
> - inst = LLVMGetNextInstruction(inst);<br>
> -<br>
> - if (LLVMGetInstructionOpcode(cur) != LLVMCall)<br>
> - continue;<br>
> -<br>
> - LLVMValueRef callee = lp_get_called_value(cur);<br>
> -<br>
> - if (!lp_is_function(callee))<br>
> - continue;<br>
> -<br>
> - const char *name = LLVMGetValueName(callee);<br>
> - unsigned num_args = LLVMCountParams(callee);<br>
> -<br>
> - /* Check if this is an export instruction. */<br>
> - if ((num_args != 9 && num_args != 8) ||<br>
> - (strcmp(name, "llvm.SI.export") &&<br>
> - strcmp(name, "llvm.amdgcn.exp.f32")))<br>
> - continue;<br>
> -<br>
> - LLVMValueRef arg = LLVMGetOperand(cur, EXP_TARGET);<br>
> - unsigned target = LLVMConstIntGetZExtValue(arg);<br>
> -<br>
> - if (target < V_008DFC_SQ_EXP_PARAM)<br>
> - continue;<br>
> -<br>
> - target -= V_008DFC_SQ_EXP_PARAM;<br>
> -<br>
> - /* Eliminate constant value PARAM exports. */<br>
> - if (si_eliminate_const_output(<wbr>ctx, cur, target)) {<br>
> - removed_any = true;<br>
> - } else {<br>
> - exports.offset[exports.num] = target;<br>
> - exports.inst[exports.num] = cur;<br>
> - exports.num++;<br>
> - }<br>
> - }<br>
> - bb = LLVMGetNextBasicBlock(bb);<br>
> - }<br>
> -<br>
> - /* Remove holes in export memory due to removed PARAM exports.<br>
> - * This is done by renumbering all PARAM exports.<br>
> - */<br>
> - if (removed_any) {<br>
> - ubyte current_offset[SI_MAX_VS_<wbr>OUTPUTS];<br>
> - unsigned new_count = 0;<br>
> - unsigned out, i;<br>
> -<br>
> - /* Make a copy of the offsets. We need the old version while<br>
> - * we are modifying some of them. */<br>
> - assert(sizeof(current_offset) ==<br>
> - sizeof(shader->info.vs_output_<wbr>param_offset));<br>
> - memcpy(current_offset, shader->info.vs_output_param_<wbr>offset,<br>
> - sizeof(current_offset));<br>
> -<br>
> - for (i = 0; i < exports.num; i++) {<br>
> - unsigned offset = exports.offset[i];<br>
> -<br>
> - for (out = 0; out < info->num_outputs; out++) {<br>
> - if (current_offset[out] != offset)<br>
> - continue;<br>
> -<br>
> - LLVMSetOperand(exports.inst[i]<wbr>, EXP_TARGET,<br>
> - LLVMConstInt(ctx->i32,<br>
> - V_008DFC_SQ_EXP_PARAM + new_count, 0));<br>
> - shader->info.vs_output_param_<wbr>offset[out] = new_count;<br>
> - new_count++;<br>
> - break;<br>
> - }<br>
> - }<br>
> - shader->info.nr_param_exports = new_count;<br>
> - }<br>
> + ac_eliminate_const_vs_outputs(<wbr>&ctx->ac,<br>
> + ctx->main_fn,<br>
> + shader->info.vs_output_param_<wbr>offset,<br>
> + info->num_outputs,<br>
> + &shader->info.nr_param_<wbr>exports);<br>
> }<br>
><br>
> static void si_count_scratch_private_<wbr>memory(struct si_shader_context *ctx)<br>
> @@ -7521,7 +7383,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,<br>
> si_init_shader_ctx(&ctx, sscreen, shader, tm);<br>
> ctx.separate_prolog = !is_monolithic;<br>
><br>
> - memset(shader->info.vs_output_<wbr>param_offset, EXP_PARAM_UNDEFINED,<br>
> + memset(shader->info.vs_output_<wbr>param_offset, AC_EXP_PARAM_UNDEFINED,<br>
> sizeof(shader->info.vs_output_<wbr>param_offset));<br>
><br>
> shader->info.uses_instanceid = sel->info.uses_instanceid;<br>
> diff --git a/src/gallium/drivers/<wbr>radeonsi/si_shader.h b/src/gallium/drivers/<wbr>radeonsi/si_shader.h<br>
> index cfa691b..2dfb567 100644<br>
> --- a/src/gallium/drivers/<wbr>radeonsi/si_shader.h<br>
> +++ b/src/gallium/drivers/<wbr>radeonsi/si_shader.h<br>
> @@ -486,18 +486,6 @@ struct si_shader_config {<br>
> unsigned rsrc2;<br>
> };<br>
><br>
> -enum {<br>
> - /* SPI_PS_INPUT_CNTL_i.OFFSET[0:<wbr>4] */<br>
> - EXP_PARAM_OFFSET_0 = 0,<br>
> - EXP_PARAM_OFFSET_31 = 31,<br>
> - /* SPI_PS_INPUT_CNTL_i.DEFAULT_<wbr>VAL[0:1] */<br>
> - EXP_PARAM_DEFAULT_VAL_0000 = 64,<br>
> - EXP_PARAM_DEFAULT_VAL_0001,<br>
> - EXP_PARAM_DEFAULT_VAL_1110,<br>
> - EXP_PARAM_DEFAULT_VAL_1111,<br>
> - EXP_PARAM_UNDEFINED = 255,<br>
> -};<br>
> -<br>
> /* GCN-specific shader info. */<br>
> struct si_shader_info {<br>
> ubyte vs_output_param_offset[SI_MAX_<wbr>VS_OUTPUTS];<br>
> diff --git a/src/gallium/drivers/<wbr>radeonsi/si_state_shaders.c b/src/gallium/drivers/<wbr>radeonsi/si_state_shaders.c<br>
> index 21185c3..baf1eae 100644<br>
> --- a/src/gallium/drivers/<wbr>radeonsi/si_state_shaders.c<br>
> +++ b/src/gallium/drivers/<wbr>radeonsi/si_state_shaders.c<br>
> @@ -39,6 +39,7 @@<br>
><br>
> #include "util/disk_cache.h"<br>
> #include "util/mesa-sha1.h"<br>
> +#include "ac_exp_param.h"<br>
><br>
> /* SHADER_CACHE */<br>
><br>
> @@ -1506,7 +1507,7 @@ void si_init_shader_selector_async(<wbr>void *job, int thread_index)<br>
> for (i = 0; i < sel->info.num_outputs; i++) {<br>
> unsigned offset = shader->info.vs_output_param_<wbr>offset[i];<br>
><br>
> - if (offset <= EXP_PARAM_OFFSET_31)<br>
> + if (offset <= AC_EXP_PARAM_OFFSET_31)<br>
> continue;<br>
><br>
> unsigned name = sel->info.output_semantic_<wbr>name[i];<br>
> @@ -2001,18 +2002,18 @@ static unsigned si_get_ps_input_cntl(struct si_context *sctx,<br>
> index == vsinfo->output_semantic_index[<wbr>j]) {<br>
> offset = vs->info.vs_output_param_<wbr>offset[j];<br>
><br>
> - if (offset <= EXP_PARAM_OFFSET_31) {<br>
> + if (offset <= AC_EXP_PARAM_OFFSET_31) {<br>
> /* The input is loaded from parameter memory. */<br>
> ps_input_cntl |= S_028644_OFFSET(offset);<br>
> } else if (!G_028644_PT_SPRITE_TEX(ps_<wbr>input_cntl)) {<br>
> - if (offset == EXP_PARAM_UNDEFINED) {<br>
> + if (offset == AC_EXP_PARAM_UNDEFINED) {<br>
> /* This can happen with depth-only rendering. */<br>
> offset = 0;<br>
> } else {<br>
> /* The input is a DEFAULT_VAL constant. */<br>
> - assert(offset >= EXP_PARAM_DEFAULT_VAL_0000 &&<br>
> - offset <= EXP_PARAM_DEFAULT_VAL_1111);<br>
> - offset -= EXP_PARAM_DEFAULT_VAL_0000;<br>
> + assert(offset >= AC_EXP_PARAM_DEFAULT_VAL_0000 &&<br>
> + offset <= AC_EXP_PARAM_DEFAULT_VAL_1111)<wbr>;<br>
> + offset -= AC_EXP_PARAM_DEFAULT_VAL_0000;<br>
> }<br>
><br>
> ps_input_cntl = S_028644_OFFSET(0x20) |<br>
</div><div class="elided-text">______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></blockquote></div><br></div></div></div>