mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-24 07:10:36 +02:00
pvr: Add PVR_SELECT() helper macro
For pvr_setup_descriptor_mappings_new() there will be quite a few variables of which the value depend on the stage so rather than having all that selection in the `switch` at the beginning of the function the helper macro provides a compact selection in the desired scope. Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21331>
This commit is contained in:
parent
ce67f5ac94
commit
7386342a19
1 changed files with 11 additions and 4 deletions
|
|
@ -3206,6 +3206,11 @@ static VkResult pvr_setup_descriptor_mappings_old(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
#define PVR_SELECT(_geom, _frag, _compute) \
|
||||
(stage == PVR_STAGE_ALLOCATION_VERTEX_GEOMETRY) \
|
||||
? (_geom) \
|
||||
: (stage == PVR_STAGE_ALLOCATION_FRAGMENT) ? (_frag) : (_compute)
|
||||
|
||||
static VkResult
|
||||
pvr_cmd_buffer_upload_desc_set_table(struct pvr_cmd_buffer *const cmd_buffer,
|
||||
enum pvr_stage_allocation stage,
|
||||
|
|
@ -3219,11 +3224,7 @@ pvr_cmd_buffer_upload_desc_set_table(struct pvr_cmd_buffer *const cmd_buffer,
|
|||
switch (stage) {
|
||||
case PVR_STAGE_ALLOCATION_VERTEX_GEOMETRY:
|
||||
case PVR_STAGE_ALLOCATION_FRAGMENT:
|
||||
desc_state = &cmd_buffer->state.gfx_desc_state;
|
||||
break;
|
||||
|
||||
case PVR_STAGE_ALLOCATION_COMPUTE:
|
||||
desc_state = &cmd_buffer->state.compute_desc_state;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -3231,6 +3232,10 @@ pvr_cmd_buffer_upload_desc_set_table(struct pvr_cmd_buffer *const cmd_buffer,
|
|||
break;
|
||||
}
|
||||
|
||||
desc_state = PVR_SELECT(&cmd_buffer->state.gfx_desc_state,
|
||||
&cmd_buffer->state.gfx_desc_state,
|
||||
&cmd_buffer->state.compute_desc_state);
|
||||
|
||||
for (uint32_t set = 0; set < ARRAY_SIZE(bound_desc_sets); set++) {
|
||||
if (!(desc_state->valid_mask & BITFIELD_BIT(set))) {
|
||||
bound_desc_sets[set] = PVR_DEV_ADDR_INVALID.addr;
|
||||
|
|
@ -3280,6 +3285,8 @@ pvr_process_addr_literal(struct pvr_cmd_buffer *cmd_buffer,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
#undef PVR_SELECT
|
||||
|
||||
static VkResult pvr_setup_descriptor_mappings_new(
|
||||
struct pvr_cmd_buffer *const cmd_buffer,
|
||||
enum pvr_stage_allocation stage,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue