diff options
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/ir3/ir3_a4xx.c | 2 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_a6xx.c | 2 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_image.c | 67 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_image.h | 2 |
4 files changed, 7 insertions, 66 deletions
diff --git a/src/freedreno/ir3/ir3_a4xx.c b/src/freedreno/ir3/ir3_a4xx.c index 264b22fd430..91385344eff 100644 --- a/src/freedreno/ir3/ir3_a4xx.c +++ b/src/freedreno/ir3/ir3_a4xx.c @@ -263,7 +263,7 @@ emit_intrinsic_store_image(struct ir3_context *ctx, nir_intrinsic_instr *intr) unsigned ncoords = ir3_get_image_coords(var, NULL); unsigned slot = ir3_get_image_slot(nir_src_as_deref(intr->src[0])); unsigned ibo_idx = ir3_image_to_ibo(ctx->so->shader, slot); - unsigned ncomp = ir3_get_num_components_for_glformat(var->data.image.format); + unsigned ncomp = ir3_get_num_components_for_image_format(var->data.image.format); /* src0 is value * src1 is coords diff --git a/src/freedreno/ir3/ir3_a6xx.c b/src/freedreno/ir3/ir3_a6xx.c index 6fed98d7673..8f9e5734d59 100644 --- a/src/freedreno/ir3/ir3_a6xx.c +++ b/src/freedreno/ir3/ir3_a6xx.c @@ -215,7 +215,7 @@ emit_intrinsic_store_image(struct ir3_context *ctx, nir_intrinsic_instr *intr) unsigned ncoords = ir3_get_image_coords(var, NULL); unsigned slot = ir3_get_image_slot(nir_src_as_deref(intr->src[0])); unsigned ibo_idx = ir3_image_to_ibo(ctx->so->shader, slot); - unsigned ncomp = ir3_get_num_components_for_glformat(var->data.image.format); + unsigned ncomp = ir3_get_num_components_for_image_format(var->data.image.format); /* src0 is offset, src1 is value: */ diff --git a/src/freedreno/ir3/ir3_image.c b/src/freedreno/ir3/ir3_image.c index 6dabf6c0376..4e96ba7e555 100644 --- a/src/freedreno/ir3/ir3_image.c +++ b/src/freedreno/ir3/ir3_image.c @@ -151,69 +151,10 @@ ir3_get_image_type(const nir_variable *var) * GL_NV_image_formats extension. */ unsigned -ir3_get_num_components_for_glformat(GLuint format) +ir3_get_num_components_for_image_format(GLuint format) { - switch (format) { - case GL_R32F: - case GL_R32I: - case GL_R32UI: - case GL_R16F: - case GL_R16I: - case GL_R16UI: - case GL_R16: - case GL_R16_SNORM: - case GL_R8I: - case GL_R8UI: - case GL_R8: - case GL_R8_SNORM: - return 1; - - case GL_RG32F: - case GL_RG32I: - case GL_RG32UI: - case GL_RG16F: - case GL_RG16I: - case GL_RG16UI: - case GL_RG16: - case GL_RG16_SNORM: - case GL_RG8I: - case GL_RG8UI: - case GL_RG8: - case GL_RG8_SNORM: - return 2; - - case GL_R11F_G11F_B10F: - return 3; - - case GL_RGBA32F: - case GL_RGBA32I: - case GL_RGBA32UI: - case GL_RGBA16F: - case GL_RGBA16I: - case GL_RGBA16UI: - case GL_RGBA16: - case GL_RGBA16_SNORM: - case GL_RGBA8I: - case GL_RGBA8UI: - case GL_RGBA8: - case GL_RGBA8_SNORM: - case GL_RGB10_A2UI: - case GL_RGB10_A2: + if (format == PIPE_FORMAT_NONE) return 4; - - case GL_NONE: - /* Omitting the image format qualifier is allowed on desktop GL - * profiles. Assuming 4 components is always safe. - */ - return 4; - - default: - /* Return 4 components also for all other formats we don't know - * about. The format should have been validated already by - * the higher level API, but drop a debug message just in case. - */ - debug_printf("Unhandled GL format %u while emitting imageStore()\n", - format); - return 4; - } + else + return util_format_get_nr_components(format); } diff --git a/src/freedreno/ir3/ir3_image.h b/src/freedreno/ir3/ir3_image.h index b0e0959b157..ac9b1bab705 100644 --- a/src/freedreno/ir3/ir3_image.h +++ b/src/freedreno/ir3/ir3_image.h @@ -39,6 +39,6 @@ unsigned ir3_image_to_tex(struct ir3_ibo_mapping *mapping, unsigned image); unsigned ir3_get_image_slot(nir_deref_instr *deref); unsigned ir3_get_image_coords(const nir_variable *var, unsigned *flagsp); type_t ir3_get_image_type(const nir_variable *var); -unsigned ir3_get_num_components_for_glformat(GLuint format); +unsigned ir3_get_num_components_for_image_format(GLuint format); #endif /* IR3_IMAGE_H_ */ |