Commit e933650c authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Decouple nr_components hw/gallium

parent f38e1d5c
......@@ -787,7 +787,7 @@ trans_emit_for_draw(struct panfrost_context *ctx)
struct panfrost_resource *rsrc = (struct panfrost_resource *) (buf->buffer.resource);
/* Offset vertex count by draw_start to make sure we upload enough */
attrs[i] = trans_attr(sizeof(float), MALI_NEGATIVE(hw->nr_components), ctx->payload_vertex.draw_start + ctx->vertex_count);
attrs[i] = trans_attr(sizeof(float), ctx->vertex->nr_components[i], ctx->payload_vertex.draw_start + ctx->vertex_count);
attrs[i].elements = panfrost_upload(&ctx->cmdstream, (uint8_t *) rsrc->cpu + buf->buffer_offset + ctx->vertex->pipe[i].src_offset, attrs[i].size, false) | 1;
}
......@@ -1247,9 +1247,11 @@ panfrost_create_vertex_elements_state(
so->num_elements = num_elements;
memcpy(so->pipe, elements, sizeof(*elements) * num_elements);
printf("Elements %d\n", num_elements);
for (int i = 0; i < num_elements; ++i) {
/* XXX: What if they're all packed into the same buffer? */
so->hw[i].index = i;
printf("Index: %d, %d\n", elements[i].src_offset, elements[i].vertex_buffer_index);
#ifdef HAVE_DRI3
enum pipe_format fmt = elements[i].src_format;
......@@ -1274,6 +1276,7 @@ panfrost_create_vertex_elements_state(
case UTIL_FORMAT_TYPE_FLOAT:
type = MALI_ATYPE_FLOAT;
printf("Float\n");
break;
default:
......@@ -1281,7 +1284,12 @@ panfrost_create_vertex_elements_state(
}
so->hw[i].type = type;
so->hw[i].nr_components = MALI_POSITIVE(desc->nr_channels);
printf("nr_components %d\n", desc->nr_channels);
int nr_chan = desc->nr_channels;
so->nr_components[i] = nr_chan;
if (nr_chan == 2)
nr_chan = 4; /* WTF? */
so->hw[i].nr_components = MALI_POSITIVE(nr_chan);
so->hw[i].not_normalised = !chan.normalized;
/* Bit used for both signed/unsigned and full/half designation */
......@@ -1292,6 +1300,7 @@ panfrost_create_vertex_elements_state(
#else
so->hw[i].type = 7;
so->hw[i].nr_components = MALI_POSITIVE(4);
so->nr_components[i] = 4;
so->hw[i].not_normalised = 1;
so->hw[i].is_int_signed = 0;
#endif
......@@ -1931,8 +1940,6 @@ panfrost_destroy(struct pipe_context *pipe)
/* TODO */
}
static void
panfrost_tile_texture(struct panfrost_context *ctx, struct panfrost_resource *rsrc)
{
......
......@@ -176,6 +176,7 @@ struct panfrost_vertex_state {
struct pipe_vertex_element pipe[PIPE_MAX_ATTRIBS];
struct mali_attr_meta hw[PIPE_MAX_ATTRIBS];
int nr_components[PIPE_MAX_ATTRIBS];
};
struct panfrost_sampler_state {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment