The OpenMAX state tracker will use this.
RadeonSI is adapted to use pipe_grid_info::last_block instead of its
internal state.
Acked-by: Leo Liu <leo.liu@amd.com>
case PIPE_CAP_MAX_VARYINGS:
return 8;
+ case PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK:
+ return 0;
+
default:
unreachable("bad PIPE_CAP_*");
}
varyings. This will generally correspond to
``PIPE_SHADER_CAP_MAX_INPUTS`` for the fragment shader, but in some
cases may be a smaller number.
+* ``PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK``: Whether pipe_grid_info::last_block
+ is implemented by the driver. See struct pipe_grid_info for more details.
.. _pipe_capf:
* allow launching waves out-of-order. (same as Vulkan) */
S_00B800_ORDER_MODE(sctx->chip_class >= CIK);
- uint *last_block = sctx->compute_last_block;
+ uint *last_block = info->last_block;
bool partial_block_en = last_block[0] || last_block[1] || last_block[2];
radeon_set_sh_reg_seq(cs, R_00B81C_COMPUTE_NUM_THREAD_X, 3);
si_create_copy_image_compute_shader_1d_array(ctx);
ctx->bind_compute_state(ctx, sctx->cs_copy_image_1d_array);
info.block[0] = 64;
- sctx->compute_last_block[0] = width % 64;
+ info.last_block[0] = width % 64;
info.block[1] = 1;
info.block[2] = 1;
info.grid[0] = DIV_ROUND_UP(width, 64);
sctx->cs_copy_image = si_create_copy_image_compute_shader(ctx);
ctx->bind_compute_state(ctx, sctx->cs_copy_image);
info.block[0] = 8;
- sctx->compute_last_block[0] = width % 8;
+ info.last_block[0] = width % 8;
info.block[1] = 8;
- sctx->compute_last_block[1] = height % 8;
+ info.last_block[1] = height % 8;
info.block[2] = 1;
info.grid[0] = DIV_ROUND_UP(width, 8);
info.grid[1] = DIV_ROUND_UP(height, 8);
ctx->launch_grid(ctx, &info);
- sctx->compute_last_block[0] = 0;
- sctx->compute_last_block[1] = 0;
-
sctx->flags |= SI_CONTEXT_CS_PARTIAL_FLUSH |
(sctx->chip_class <= VI ? SI_CONTEXT_WRITEBACK_GLOBAL_L2 : 0) |
si_get_flush_flags(sctx, SI_COHERENCY_SHADER, L2_STREAM);
sctx->cs_clear_render_target = si_clear_render_target_shader(ctx);
ctx->bind_compute_state(ctx, sctx->cs_clear_render_target);
info.block[0] = 8;
- sctx->compute_last_block[0] = width % 8;
+ info.last_block[0] = width % 8;
info.block[1] = 8;
- sctx->compute_last_block[1] = height % 8;
+ info.last_block[1] = height % 8;
info.block[2] = 1;
info.grid[0] = DIV_ROUND_UP(width, 8);
info.grid[1] = DIV_ROUND_UP(height, 8);
si_clear_render_target_shader_1d_array(ctx);
ctx->bind_compute_state(ctx, sctx->cs_clear_render_target_1d_array);
info.block[0] = 64;
- sctx->compute_last_block[0] = width % 64;
+ info.last_block[0] = width % 64;
info.block[1] = 1;
info.block[2] = 1;
info.grid[0] = DIV_ROUND_UP(width, 64);
ctx->launch_grid(ctx, &info);
- sctx->compute_last_block[0] = 0;
- sctx->compute_last_block[1] = 0;
-
sctx->flags |= SI_CONTEXT_CS_PARTIAL_FLUSH |
(sctx->chip_class <= VI ? SI_CONTEXT_WRITEBACK_GLOBAL_L2 : 0) |
si_get_flush_flags(sctx, SI_COHERENCY_SHADER, L2_STREAM);
case PIPE_CAP_TGSI_BALLOT:
case PIPE_CAP_TGSI_VOTE:
case PIPE_CAP_TGSI_FS_FBFETCH:
+ case PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK:
return 1;
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
uint32_t vs_blit_sh_data[SI_VS_BLIT_SGPRS_POS_TEXCOORD];
uint32_t cs_user_data[4];
- /**
- * last_block allows disabling threads at the farthermost grid boundary.
- * Full blocks as specified by "block" are launched, but the threads
- * outside of "last_block" dimensions are disabled.
- *
- * If a block touches the grid boundary in the i-th axis, threads with
- * THREAD_ID[i] >= last_block[i] are disabled.
- *
- * If last_block[i] is 0, it has the same behavior as last_block[i] = block[i],
- * meaning no effect.
- *
- * It's equivalent to doing this at the beginning of the compute shader:
- *
- * for (i = 0; i < 3; i++) {
- * if (block_id[i] == grid[i] - 1 &&
- * last_block[i] && last_block[i] >= thread_id[i])
- * return;
- * }
- * (this could be moved into pipe_grid_info)
- */
- uint compute_last_block[3];
-
/* Vertex and index buffers. */
bool vertex_buffers_dirty;
bool vertex_buffer_pointer_dirty;
PIPE_CAP_DEST_SURFACE_SRGB_CONTROL,
PIPE_CAP_NIR_COMPACT_ARRAYS,
PIPE_CAP_MAX_VARYINGS,
+ PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK,
};
/**
*/
uint block[3];
+ /**
+ * last_block allows disabling threads at the farthermost grid boundary.
+ * Full blocks as specified by "block" are launched, but the threads
+ * outside of "last_block" dimensions are disabled.
+ *
+ * If a block touches the grid boundary in the i-th axis, threads with
+ * THREAD_ID[i] >= last_block[i] are disabled.
+ *
+ * If last_block[i] is 0, it has the same behavior as last_block[i] = block[i],
+ * meaning no effect.
+ *
+ * It's equivalent to doing this at the beginning of the compute shader:
+ *
+ * for (i = 0; i < 3; i++) {
+ * if (block_id[i] == grid[i] - 1 &&
+ * last_block[i] && thread_id[i] >= last_block[i])
+ * return;
+ * }
+ */
+ uint last_block[3];
+
/**
* Determine the layout of the grid (in block units) to be used.
*/