mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
draw: initialize vertex header
This commit is contained in:
parent
4ae530370d
commit
5cf1921e6d
3 changed files with 16 additions and 43 deletions
|
|
@ -260,7 +260,7 @@ void draw_pipeline_run( struct draw_context *draw,
|
|||
const struct draw_prim_info *prim_info)
|
||||
{
|
||||
unsigned i, start;
|
||||
|
||||
|
||||
draw->pipeline.verts = (char *)vert_info->verts;
|
||||
draw->pipeline.vertex_stride = vert_info->stride;
|
||||
draw->pipeline.vertex_count = vert_info->count;
|
||||
|
|
|
|||
|
|
@ -68,31 +68,12 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
|
|||
|
||||
fetch->vertex_size = vertex_size;
|
||||
|
||||
/* Always emit/leave space for a vertex header.
|
||||
*
|
||||
* It's worth considering whether the vertex headers should contain
|
||||
* a pointer to the 'data', rather than having it inline.
|
||||
* Something to look at after we've fully switched over to the pt
|
||||
* paths.
|
||||
/* Leave the clipmask/edgeflags/pad/vertex_id untouched
|
||||
*/
|
||||
{
|
||||
/* Need to set header->vertex_id = 0xffff somehow.
|
||||
*/
|
||||
key.element[nr].type = TRANSLATE_ELEMENT_NORMAL;
|
||||
key.element[nr].input_format = PIPE_FORMAT_R32_FLOAT;
|
||||
key.element[nr].input_buffer = draw->pt.nr_vertex_buffers;
|
||||
key.element[nr].input_offset = 0;
|
||||
key.element[nr].instance_divisor = 0;
|
||||
key.element[nr].output_format = PIPE_FORMAT_R32_FLOAT;
|
||||
key.element[nr].output_offset = dst_offset;
|
||||
dst_offset += 1 * sizeof(float);
|
||||
nr++;
|
||||
|
||||
|
||||
/* Just leave the clip[] array untouched.
|
||||
*/
|
||||
dst_offset += 4 * sizeof(float);
|
||||
}
|
||||
dst_offset += 1 * sizeof(float);
|
||||
/* Just leave the clip[] array untouched.
|
||||
*/
|
||||
dst_offset += 4 * sizeof(float);
|
||||
|
||||
if (instance_id_index != ~0) {
|
||||
num_extra_inputs++;
|
||||
|
|
@ -131,26 +112,11 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
|
|||
key.nr_elements = nr;
|
||||
key.output_stride = vertex_size;
|
||||
|
||||
|
||||
if (!fetch->translate ||
|
||||
translate_key_compare(&fetch->translate->key, &key) != 0)
|
||||
{
|
||||
translate_key_sanitize(&key);
|
||||
fetch->translate = translate_cache_find(fetch->cache, &key);
|
||||
|
||||
{
|
||||
static struct vertex_header vh = { 0,
|
||||
1,
|
||||
0,
|
||||
UNDEFINED_VERTEX_ID,
|
||||
{ .0f, .0f, .0f, .0f } };
|
||||
|
||||
fetch->translate->set_buffer(fetch->translate,
|
||||
draw->pt.nr_vertex_buffers,
|
||||
&vh,
|
||||
0,
|
||||
~0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,14 @@ struct pt_post_vs {
|
|||
struct draw_vertex_info *info );
|
||||
};
|
||||
|
||||
|
||||
static INLINE void
|
||||
initialize_vertex_header(struct vertex_header *header)
|
||||
{
|
||||
header->clipmask = 0;
|
||||
header->edgeflag = 1;
|
||||
header->pad = 0;
|
||||
header->vertex_id = UNDEFINED_VERTEX_ID;
|
||||
}
|
||||
|
||||
static INLINE float
|
||||
dot4(const float *a, const float *b)
|
||||
|
|
@ -49,8 +56,6 @@ dot4(const float *a, const float *b)
|
|||
a[3]*b[3]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static INLINE unsigned
|
||||
compute_clipmask_gl(const float *clip, /*const*/ float plane[][4], unsigned nr)
|
||||
{
|
||||
|
|
@ -103,6 +108,7 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs,
|
|||
for (j = 0; j < info->count; j++) {
|
||||
float *position = out->data[pos];
|
||||
|
||||
initialize_vertex_header(out);
|
||||
#if 0
|
||||
debug_printf("%d) io = %p, data = %p = [%f, %f, %f, %f]\n",
|
||||
j, out, position, position[0], position[1], position[2], position[3]);
|
||||
|
|
@ -192,6 +198,7 @@ static boolean post_vs_viewport( struct pt_post_vs *pvs,
|
|||
for (j = 0; j < info->count; j++) {
|
||||
float *position = out->data[pos];
|
||||
|
||||
initialize_vertex_header(out);
|
||||
/* Viewport mapping only, no cliptest/rhw divide
|
||||
*/
|
||||
position[0] = position[0] * scale[0] + trans[0];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue