Re: [Mesa-dev] [PATCH] ac: teach get_ac_sampler_dim() about subpass attachments
Thanks! Reviewed-by: Nicolai HähnleOn 23.04.2018 16:55, Samuel Pitoiset wrote: Suggested by Nicolai. Signed-off-by: Samuel Pitoiset --- src/amd/common/ac_nir_to_llvm.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 34efb2b9fe1..900c1c4afea 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -87,7 +87,6 @@ get_ac_sampler_dim(const struct ac_llvm_context *ctx, enum glsl_sampler_dim dim, return is_array ? ac_image_1darray : ac_image_1d; case GLSL_SAMPLER_DIM_2D: case GLSL_SAMPLER_DIM_RECT: - case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_EXTERNAL: return is_array ? ac_image_2darray : ac_image_2d; case GLSL_SAMPLER_DIM_3D: @@ -95,8 +94,11 @@ get_ac_sampler_dim(const struct ac_llvm_context *ctx, enum glsl_sampler_dim dim, case GLSL_SAMPLER_DIM_CUBE: return ac_image_cube; case GLSL_SAMPLER_DIM_MS: - case GLSL_SAMPLER_DIM_SUBPASS_MS: return is_array ? ac_image_2darraymsaa : ac_image_2dmsaa; + case GLSL_SAMPLER_DIM_SUBPASS: + return ac_image_2darray; + case GLSL_SAMPLER_DIM_SUBPASS_MS: + return ac_image_2darraymsaa; default: unreachable("bad sampler dim"); } @@ -2090,18 +2092,6 @@ static LLVMValueRef adjust_sample_index_using_fmask(struct ac_llvm_context *ctx, return sample_index; } -static bool -glsl_is_array_image(const struct glsl_type *type) -{ - const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); - - if (glsl_sampler_type_is_array(type)) - return true; - - return dim == GLSL_SAMPLER_DIM_SUBPASS || - dim == GLSL_SAMPLER_DIM_SUBPASS_MS; -} - static void get_image_coords(struct ac_nir_context *ctx, const nir_intrinsic_instr *instr, struct ac_image_args *args) @@ -2247,7 +2237,7 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx, args.resource = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE, NULL, true, false); args.dim = get_ac_image_dim(>ac, glsl_get_sampler_dim(type), - glsl_is_array_image(type)); + glsl_sampler_type_is_array(type)); args.dmask = 15; args.attributes = AC_FUNC_ATTR_READONLY; if (var->data.image._volatile || var->data.image.coherent) @@ -2290,7 +2280,7 @@ static void visit_image_store(struct ac_nir_context *ctx, args.resource = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE, NULL, true, false); args.dim = get_ac_image_dim(>ac, glsl_get_sampler_dim(type), - glsl_is_array_image(type)); + glsl_sampler_type_is_array(type)); args.dmask = 15; if (force_glc || var->data.image._volatile || var->data.image.coherent) args.cache_policy |= ac_glc; @@ -2381,7 +2371,7 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx, args.resource = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE, NULL, true, false); args.dim = get_ac_image_dim(>ac, glsl_get_sampler_dim(type), - glsl_is_array_image(type)); + glsl_sampler_type_is_array(type)); return ac_build_image_opcode(>ac, ); } -- Lerne, wie die Welt wirklich ist, Aber vergiss niemals, wie sie sein sollte. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] ac: teach get_ac_sampler_dim() about subpass attachments
works for me. Reviewed-by: Bas NieuwenhuizenOn Mon, Apr 23, 2018 at 7:55 AM, Samuel Pitoiset wrote: > Suggested by Nicolai. > > Signed-off-by: Samuel Pitoiset > --- > src/amd/common/ac_nir_to_llvm.c | 24 +++- > 1 file changed, 7 insertions(+), 17 deletions(-) > > diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c > index 34efb2b9fe1..900c1c4afea 100644 > --- a/src/amd/common/ac_nir_to_llvm.c > +++ b/src/amd/common/ac_nir_to_llvm.c > @@ -87,7 +87,6 @@ get_ac_sampler_dim(const struct ac_llvm_context *ctx, enum > glsl_sampler_dim dim, > return is_array ? ac_image_1darray : ac_image_1d; > case GLSL_SAMPLER_DIM_2D: > case GLSL_SAMPLER_DIM_RECT: > - case GLSL_SAMPLER_DIM_SUBPASS: > case GLSL_SAMPLER_DIM_EXTERNAL: > return is_array ? ac_image_2darray : ac_image_2d; > case GLSL_SAMPLER_DIM_3D: > @@ -95,8 +94,11 @@ get_ac_sampler_dim(const struct ac_llvm_context *ctx, enum > glsl_sampler_dim dim, > case GLSL_SAMPLER_DIM_CUBE: > return ac_image_cube; > case GLSL_SAMPLER_DIM_MS: > - case GLSL_SAMPLER_DIM_SUBPASS_MS: > return is_array ? ac_image_2darraymsaa : ac_image_2dmsaa; > + case GLSL_SAMPLER_DIM_SUBPASS: > + return ac_image_2darray; > + case GLSL_SAMPLER_DIM_SUBPASS_MS: > + return ac_image_2darraymsaa; > default: > unreachable("bad sampler dim"); > } > @@ -2090,18 +2092,6 @@ static LLVMValueRef > adjust_sample_index_using_fmask(struct ac_llvm_context *ctx, > return sample_index; > } > > -static bool > -glsl_is_array_image(const struct glsl_type *type) > -{ > - const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); > - > - if (glsl_sampler_type_is_array(type)) > - return true; > - > - return dim == GLSL_SAMPLER_DIM_SUBPASS || > - dim == GLSL_SAMPLER_DIM_SUBPASS_MS; > -} > - > static void get_image_coords(struct ac_nir_context *ctx, > const nir_intrinsic_instr *instr, > struct ac_image_args *args) > @@ -2247,7 +2237,7 @@ static LLVMValueRef visit_image_load(struct > ac_nir_context *ctx, > args.resource = get_sampler_desc(ctx, instr->variables[0], > AC_DESC_IMAGE, NULL, true, > false); > args.dim = get_ac_image_dim(>ac, > glsl_get_sampler_dim(type), > - glsl_is_array_image(type)); > + glsl_sampler_type_is_array(type)); > args.dmask = 15; > args.attributes = AC_FUNC_ATTR_READONLY; > if (var->data.image._volatile || var->data.image.coherent) > @@ -2290,7 +2280,7 @@ static void visit_image_store(struct ac_nir_context > *ctx, > args.resource = get_sampler_desc(ctx, instr->variables[0], > AC_DESC_IMAGE, NULL, true, > false); > args.dim = get_ac_image_dim(>ac, > glsl_get_sampler_dim(type), > - glsl_is_array_image(type)); > + glsl_sampler_type_is_array(type)); > args.dmask = 15; > if (force_glc || var->data.image._volatile || > var->data.image.coherent) > args.cache_policy |= ac_glc; > @@ -2381,7 +2371,7 @@ static LLVMValueRef visit_image_atomic(struct > ac_nir_context *ctx, > args.resource = get_sampler_desc(ctx, instr->variables[0], > AC_DESC_IMAGE, NULL, true, > false); > args.dim = get_ac_image_dim(>ac, > glsl_get_sampler_dim(type), > - glsl_is_array_image(type)); > + glsl_sampler_type_is_array(type)); > > return ac_build_image_opcode(>ac, ); > } > -- > 2.17.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] ac: teach get_ac_sampler_dim() about subpass attachments
Suggested by Nicolai. Signed-off-by: Samuel Pitoiset--- src/amd/common/ac_nir_to_llvm.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 34efb2b9fe1..900c1c4afea 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -87,7 +87,6 @@ get_ac_sampler_dim(const struct ac_llvm_context *ctx, enum glsl_sampler_dim dim, return is_array ? ac_image_1darray : ac_image_1d; case GLSL_SAMPLER_DIM_2D: case GLSL_SAMPLER_DIM_RECT: - case GLSL_SAMPLER_DIM_SUBPASS: case GLSL_SAMPLER_DIM_EXTERNAL: return is_array ? ac_image_2darray : ac_image_2d; case GLSL_SAMPLER_DIM_3D: @@ -95,8 +94,11 @@ get_ac_sampler_dim(const struct ac_llvm_context *ctx, enum glsl_sampler_dim dim, case GLSL_SAMPLER_DIM_CUBE: return ac_image_cube; case GLSL_SAMPLER_DIM_MS: - case GLSL_SAMPLER_DIM_SUBPASS_MS: return is_array ? ac_image_2darraymsaa : ac_image_2dmsaa; + case GLSL_SAMPLER_DIM_SUBPASS: + return ac_image_2darray; + case GLSL_SAMPLER_DIM_SUBPASS_MS: + return ac_image_2darraymsaa; default: unreachable("bad sampler dim"); } @@ -2090,18 +2092,6 @@ static LLVMValueRef adjust_sample_index_using_fmask(struct ac_llvm_context *ctx, return sample_index; } -static bool -glsl_is_array_image(const struct glsl_type *type) -{ - const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); - - if (glsl_sampler_type_is_array(type)) - return true; - - return dim == GLSL_SAMPLER_DIM_SUBPASS || - dim == GLSL_SAMPLER_DIM_SUBPASS_MS; -} - static void get_image_coords(struct ac_nir_context *ctx, const nir_intrinsic_instr *instr, struct ac_image_args *args) @@ -2247,7 +2237,7 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx, args.resource = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE, NULL, true, false); args.dim = get_ac_image_dim(>ac, glsl_get_sampler_dim(type), - glsl_is_array_image(type)); + glsl_sampler_type_is_array(type)); args.dmask = 15; args.attributes = AC_FUNC_ATTR_READONLY; if (var->data.image._volatile || var->data.image.coherent) @@ -2290,7 +2280,7 @@ static void visit_image_store(struct ac_nir_context *ctx, args.resource = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE, NULL, true, false); args.dim = get_ac_image_dim(>ac, glsl_get_sampler_dim(type), - glsl_is_array_image(type)); + glsl_sampler_type_is_array(type)); args.dmask = 15; if (force_glc || var->data.image._volatile || var->data.image.coherent) args.cache_policy |= ac_glc; @@ -2381,7 +2371,7 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx, args.resource = get_sampler_desc(ctx, instr->variables[0], AC_DESC_IMAGE, NULL, true, false); args.dim = get_ac_image_dim(>ac, glsl_get_sampler_dim(type), - glsl_is_array_image(type)); + glsl_sampler_type_is_array(type)); return ac_build_image_opcode(>ac, ); } -- 2.17.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev