aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-09-12 21:39:31 -0400
committerMarek Olšák <[email protected]>2019-10-09 17:12:33 -0400
commitc0575a62413039a1bbfe2436a8327783a1131a8d (patch)
treef591a31cf05aef1c8d2c2529ec26c0f00b0ce8fd /src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
parent743a9d85e2ca5aef93e40fe7833742a067a5943d (diff)
radeonsi: clean up image_fetch_rsrc
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index 10fbb808e9b..d3a4dc48485 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -214,48 +214,42 @@ image_fetch_rsrc(
LLVMValueRef *rsrc)
{
struct si_shader_context *ctx = si_shader_context(bld_base);
- LLVMValueRef rsrc_ptr = LLVMGetParam(ctx->main_fn,
- ctx->param_samplers_and_images);
- LLVMValueRef index;
-
- if (!image->Register.Indirect) {
- index = LLVMConstInt(ctx->i32,
- si_get_image_slot(image->Register.Index), 0);
- } else {
- /* From the GL_ARB_shader_image_load_store extension spec:
- *
- * If a shader performs an image load, store, or atomic
- * operation using an image variable declared as an array,
- * and if the index used to select an individual element is
- * negative or greater than or equal to the size of the
- * array, the results of the operation are undefined but may
- * not lead to termination.
- */
- index = si_get_bounded_indirect_index(ctx, &image->Indirect,
- image->Register.Index,
- ctx->num_images);
- index = LLVMBuildSub(ctx->ac.builder,
- LLVMConstInt(ctx->i32, SI_NUM_IMAGE_SLOTS - 1, 0),
- index, "");
- }
-
- bool bindless = false;
+ bool bindless = image->Register.File != TGSI_FILE_IMAGE;
+ LLVMValueRef rsrc_ptr, index;
- if (image->Register.File != TGSI_FILE_IMAGE) {
+ if (bindless) {
/* Bindless descriptors are accessible from a different pair of
* user SGPR indices.
*/
rsrc_ptr = LLVMGetParam(ctx->main_fn,
ctx->param_bindless_samplers_and_images);
- index = lp_build_emit_fetch_src(bld_base, image,
- TGSI_TYPE_UNSIGNED, 0);
+ index = lp_build_emit_fetch_src(bld_base, image, TGSI_TYPE_UNSIGNED, 0);
- /* For simplicity, bindless image descriptors use fixed
- * 16-dword slots for now.
- */
+ /* Bindless image descriptors use 16-dword slots. */
index = LLVMBuildMul(ctx->ac.builder, index,
LLVMConstInt(ctx->i32, 2, 0), "");
- bindless = true;
+ } else {
+ rsrc_ptr = LLVMGetParam(ctx->main_fn, ctx->param_samplers_and_images);
+
+ if (!image->Register.Indirect) {
+ index = LLVMConstInt(ctx->i32, image->Register.Index, 0);
+ } else {
+ /* From the GL_ARB_shader_image_load_store extension spec:
+ *
+ * If a shader performs an image load, store, or atomic
+ * operation using an image variable declared as an array,
+ * and if the index used to select an individual element is
+ * negative or greater than or equal to the size of the
+ * array, the results of the operation are undefined but may
+ * not lead to termination.
+ */
+ index = si_get_bounded_indirect_index(ctx, &image->Indirect,
+ image->Register.Index,
+ ctx->num_images);
+ }
+ index = LLVMBuildSub(ctx->ac.builder,
+ LLVMConstInt(ctx->i32, SI_NUM_IMAGE_SLOTS - 1, 0),
+ index, "");
}
*rsrc = si_load_image_desc(ctx, rsrc_ptr, index,