anv/blorp: Encapsulate subpass id querying
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
c78a959bcf
commit
9950774f8b
|
@ -1069,9 +1069,7 @@ attachment_needs_flush(struct anv_cmd_buffer *cmd_buffer,
|
||||||
enum subpass_stage stage)
|
enum subpass_stage stage)
|
||||||
{
|
{
|
||||||
struct anv_render_pass *pass = cmd_buffer->state.pass;
|
struct anv_render_pass *pass = cmd_buffer->state.pass;
|
||||||
struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
const uint32_t subpass_idx = anv_get_subpass_id(&cmd_buffer->state);
|
||||||
unsigned subpass_idx = subpass - pass->subpasses;
|
|
||||||
assert(subpass_idx < pass->subpass_count);
|
|
||||||
|
|
||||||
/* We handle this subpass specially based on the current stage */
|
/* We handle this subpass specially based on the current stage */
|
||||||
enum anv_subpass_usage usage = att->subpass_usage[subpass_idx];
|
enum anv_subpass_usage usage = att->subpass_usage[subpass_idx];
|
||||||
|
@ -1407,9 +1405,7 @@ ccs_resolve_attachment(struct anv_cmd_buffer *cmd_buffer,
|
||||||
att_state->aux_usage == ISL_AUX_USAGE_CCS_D);
|
att_state->aux_usage == ISL_AUX_USAGE_CCS_D);
|
||||||
|
|
||||||
struct anv_render_pass *pass = cmd_buffer->state.pass;
|
struct anv_render_pass *pass = cmd_buffer->state.pass;
|
||||||
struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
const uint32_t subpass_idx = anv_get_subpass_id(&cmd_buffer->state);
|
||||||
unsigned subpass_idx = subpass - pass->subpasses;
|
|
||||||
assert(subpass_idx < pass->subpass_count);
|
|
||||||
|
|
||||||
/* Scan forward to see what all ways this attachment will be used.
|
/* Scan forward to see what all ways this attachment will be used.
|
||||||
* Ideally, we would like to resolve in the same subpass as the last write
|
* Ideally, we would like to resolve in the same subpass as the last write
|
||||||
|
|
|
@ -2009,6 +2009,21 @@ void anv_dump_finish(void);
|
||||||
void anv_dump_add_framebuffer(struct anv_cmd_buffer *cmd_buffer,
|
void anv_dump_add_framebuffer(struct anv_cmd_buffer *cmd_buffer,
|
||||||
struct anv_framebuffer *fb);
|
struct anv_framebuffer *fb);
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
anv_get_subpass_id(const struct anv_cmd_state * const cmd_state)
|
||||||
|
{
|
||||||
|
/* This function must be called from within a subpass. */
|
||||||
|
assert(cmd_state->pass && cmd_state->subpass);
|
||||||
|
|
||||||
|
const uint32_t subpass_id = cmd_state->subpass - cmd_state->pass->subpasses;
|
||||||
|
|
||||||
|
/* The id of this subpass shouldn't exceed the number of subpasses in this
|
||||||
|
* render pass minus 1.
|
||||||
|
*/
|
||||||
|
assert(subpass_id < cmd_state->pass->subpass_count);
|
||||||
|
return subpass_id;
|
||||||
|
}
|
||||||
|
|
||||||
#define ANV_DEFINE_HANDLE_CASTS(__anv_type, __VkType) \
|
#define ANV_DEFINE_HANDLE_CASTS(__anv_type, __VkType) \
|
||||||
\
|
\
|
||||||
static inline struct __anv_type * \
|
static inline struct __anv_type * \
|
||||||
|
|
Loading…
Reference in New Issue