[Mesa-dev] [PATCH] ac/nir: call glsl_get_sampler_dim() only once, where possible (v2)
Timothy Arceri
tarceri at itsqueeze.com
Sun Jan 28 23:49:54 UTC 2018
On 27/01/18 22:07, Kai Wasserbäch wrote:
> Ping. This patch has a T-b by Dieter Nützel (including v2), any R-b and commit
> would be much appreciated.
>
> (Timothy indicated on Wednesday he would try to commit this
> (<https://people.freedesktop.org/~cbrill/dri-log/index.php?channel=dri-devel&date=2018-01-24#t-0912>),
> but I guess it must have slipped through the cracks.)
I was busy tracking down a bug the was crashing KDE :P I've pushed this
patch thanks :)
>
>
> Kai Wasserbäch wrote on 23.01.2018 21:14:
>> Changes since v1:
>> * Rebased on top of e68150de263156a3f3d1b609b6506c5649967f61 and
>> 82adf53308c137ce0dc5f2d5da4e7cc40c5b808c.
>>
>> Cc: Timothy Arceri <tarceri at itsqueeze.com>
>> Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de> (v1)
>> Signed-off-by: Kai Wasserbäch <kai at dev.carbon-project.org>
>> ---
>>
>> Hey,
>> if you accept this patch, please commit it for me – I do not have commit
>> access. This is v2, which is needed since the above mentioned changes
>> by Timothy went in first.
>>
>> Thanks,
>> Kai
>>
>> src/amd/common/ac_nir_to_llvm.c | 19 +++++++++++--------
>> 1 file changed, 11 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
>> index cc3af77386..0fba5a1068 100644
>> --- a/src/amd/common/ac_nir_to_llvm.c
>> +++ b/src/amd/common/ac_nir_to_llvm.c
>> @@ -3620,7 +3620,9 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx,
>> type = instr->variables[0]->deref.child->type;
>>
>> type = glsl_without_array(type);
>> - if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_BUF) {
>> +
>> + const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type);
>> + if (dim == GLSL_SAMPLER_DIM_BUF) {
>> params[0] = get_sampler_desc(ctx, instr->variables[0], AC_DESC_BUFFER, NULL, true, false);
>> params[1] = LLVMBuildExtractElement(ctx->ac.builder, get_src(ctx, instr->src[0]),
>> ctx->ac.i32_0, ""); /* vindex */
>> @@ -3634,10 +3636,10 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx,
>> res = ac_to_integer(&ctx->ac, res);
>> } else {
>> bool is_da = glsl_sampler_type_is_array(type) ||
>> - glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE ||
>> - glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_3D ||
>> - glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_SUBPASS ||
>> - glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_SUBPASS_MS;
>> + dim == GLSL_SAMPLER_DIM_CUBE ||
>> + dim == GLSL_SAMPLER_DIM_3D ||
>> + dim == GLSL_SAMPLER_DIM_SUBPASS ||
>> + dim == GLSL_SAMPLER_DIM_SUBPASS_MS;
>> LLVMValueRef da = is_da ? ctx->ac.i1true : ctx->ac.i1false;
>> LLVMValueRef glc = ctx->ac.i1false;
>> LLVMValueRef slc = ctx->ac.i1false;
>> @@ -3677,12 +3679,13 @@ static void visit_image_store(struct ac_nir_context *ctx,
>> char intrinsic_name[64];
>> const nir_variable *var = instr->variables[0]->var;
>> const struct glsl_type *type = glsl_without_array(var->type);
>> + const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type);
>> LLVMValueRef glc = ctx->ac.i1false;
>> bool force_glc = ctx->ac.chip_class == SI;
>> if (force_glc)
>> glc = ctx->ac.i1true;
>>
>> - if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_BUF) {
>> + if (dim == GLSL_SAMPLER_DIM_BUF) {
>> params[0] = ac_to_float(&ctx->ac, get_src(ctx, instr->src[2])); /* data */
>> params[1] = get_sampler_desc(ctx, instr->variables[0], AC_DESC_BUFFER, NULL, true, true);
>> params[2] = LLVMBuildExtractElement(ctx->ac.builder, get_src(ctx, instr->src[0]),
>> @@ -3694,8 +3697,8 @@ static void visit_image_store(struct ac_nir_context *ctx,
>> params, 6, 0);
>> } else {
>> bool is_da = glsl_sampler_type_is_array(type) ||
>> - glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE ||
>> - glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_3D;
>> + dim == GLSL_SAMPLER_DIM_CUBE ||
>> + dim == GLSL_SAMPLER_DIM_3D;
>> LLVMValueRef da = is_da ? ctx->ac.i1true : ctx->ac.i1false;
>> LLVMValueRef slc = ctx->ac.i1false;
>>
>>
>
More information about the mesa-dev
mailing list