mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02:00
v3d: default vertex attributes values are not needed for v71
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
This commit is contained in:
parent
b833243348
commit
2908b2782a
3 changed files with 36 additions and 19 deletions
|
|
@ -268,6 +268,7 @@ struct v3d_vertex_stateobj {
|
|||
unsigned num_elements;
|
||||
|
||||
uint8_t attrs[16 * (V3D_MAX_VS_INPUTS / 4)];
|
||||
/* defaults can be NULL for some hw generation */
|
||||
struct pipe_resource *defaults;
|
||||
uint32_t defaults_offset;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -759,9 +759,6 @@ v3d_emit_gl_shader_state(struct v3d_context *v3d,
|
|||
shader.address_of_default_attribute_values =
|
||||
cl_address(v3d_resource(vtx->defaults)->bo,
|
||||
vtx->defaults_offset);
|
||||
#endif
|
||||
#if V3D_VERSION >= 71
|
||||
unreachable("HW generation 71 not supported yet.");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -336,6 +336,20 @@ v3d_zsa_state_bind(struct pipe_context *pctx, void *hwcso)
|
|||
v3d->dirty |= V3D_DIRTY_ZSA;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
needs_default_attribute_values(void)
|
||||
{
|
||||
#if V3D_VERSION <= 42
|
||||
/* FIXME: on vulkan we are able to refine even further, as we know in
|
||||
* advance when we create the pipeline if we have an integer vertex
|
||||
* attrib. Pending to check if we could do something similar here.
|
||||
*/
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
static void *
|
||||
v3d_vertex_state_create(struct pipe_context *pctx, unsigned num_elements,
|
||||
const struct pipe_vertex_element *elements)
|
||||
|
|
@ -413,24 +427,29 @@ v3d_vertex_state_create(struct pipe_context *pctx, unsigned num_elements,
|
|||
}
|
||||
}
|
||||
|
||||
/* Set up the default attribute values in case any of the vertex
|
||||
* elements use them.
|
||||
*/
|
||||
uint32_t *attrs;
|
||||
u_upload_alloc(v3d->state_uploader, 0,
|
||||
V3D_MAX_VS_INPUTS * sizeof(float), 16,
|
||||
&so->defaults_offset, &so->defaults, (void **)&attrs);
|
||||
if (needs_default_attribute_values()) {
|
||||
/* Set up the default attribute values in case any of the vertex
|
||||
* elements use them.
|
||||
*/
|
||||
uint32_t *attrs;
|
||||
u_upload_alloc(v3d->state_uploader, 0,
|
||||
V3D_MAX_VS_INPUTS * sizeof(float), 16,
|
||||
&so->defaults_offset, &so->defaults, (void **)&attrs);
|
||||
|
||||
for (int i = 0; i < V3D_MAX_VS_INPUTS / 4; i++) {
|
||||
attrs[i * 4 + 0] = 0;
|
||||
attrs[i * 4 + 1] = 0;
|
||||
attrs[i * 4 + 2] = 0;
|
||||
if (i < so->num_elements &&
|
||||
util_format_is_pure_integer(so->pipe[i].src_format)) {
|
||||
attrs[i * 4 + 3] = 1;
|
||||
} else {
|
||||
attrs[i * 4 + 3] = fui(1.0);
|
||||
for (int i = 0; i < V3D_MAX_VS_INPUTS / 4; i++) {
|
||||
attrs[i * 4 + 0] = 0;
|
||||
attrs[i * 4 + 1] = 0;
|
||||
attrs[i * 4 + 2] = 0;
|
||||
if (i < so->num_elements &&
|
||||
util_format_is_pure_integer(so->pipe[i].src_format)) {
|
||||
attrs[i * 4 + 3] = 1;
|
||||
} else {
|
||||
attrs[i * 4 + 3] = fui(1.0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
so->defaults = NULL;
|
||||
so->defaults_offset = 0;
|
||||
}
|
||||
|
||||
u_upload_unmap(v3d->state_uploader);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue