From 76ff89d2de3807f316954aa97ffdbb51bb3b6966 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 5 Jan 2010 11:48:32 +0100 Subject: [PATCH] gallium: Handle InstanceID as a true 32-bit uint. --- src/gallium/auxiliary/draw/draw_pt_fetch.c | 13 +++++++---- .../auxiliary/translate/translate_sse.c | 23 ++++--------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c index 36c27e22ff9..55e7a7b81ad 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c @@ -107,19 +107,24 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch, for (i = 0; i < nr_inputs; i++) { if (i == instance_id_index) { key.element[nr].type = TRANSLATE_ELEMENT_INSTANCE_ID; - key.element[nr].input_format = PIPE_FORMAT_R32_FLOAT; /* XXX: Make it UINT. */ + key.element[nr].input_format = PIPE_FORMAT_R32_USCALED; + key.element[nr].output_format = PIPE_FORMAT_R32_USCALED; + key.element[nr].output_offset = dst_offset; + + dst_offset += sizeof(uint); } else { key.element[nr].type = TRANSLATE_ELEMENT_NORMAL; key.element[nr].input_format = draw->pt.vertex_element[ei].src_format; key.element[nr].input_buffer = draw->pt.vertex_element[ei].vertex_buffer_index; key.element[nr].input_offset = draw->pt.vertex_element[ei].src_offset; key.element[nr].instance_divisor = draw->pt.vertex_element[ei].instance_divisor; + key.element[nr].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + key.element[nr].output_offset = dst_offset; + ei++; + dst_offset += 4 * sizeof(float); } - key.element[nr].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; - key.element[nr].output_offset = dst_offset; - dst_offset += 4 * sizeof(float); nr++; } diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 8e152a002a3..c13e7427387 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -50,15 +50,13 @@ typedef void (PIPE_CDECL *run_func)( struct translate *translate, unsigned start, unsigned count, unsigned instance_id, - void *output_buffer, - float instance_id_float ); + void *output_buffer); typedef void (PIPE_CDECL *run_elts_func)( struct translate *translate, const unsigned *elts, unsigned count, unsigned instance_id, - void *output_buffer, - float instance_id_float ); + void *output_buffer); struct translate_buffer { const void *base_ptr; @@ -102,7 +100,6 @@ struct translate_sse { boolean use_instancing; unsigned instance_id; - float instance_id_float; /* XXX: needed while no integer support in TGSI */ run_func gen_run; run_elts_func gen_run_elts; @@ -451,7 +448,7 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p, { if (var_idx == ELEMENT_BUFFER_INSTANCE_ID) { return x86_make_disp(p->machine_EDX, - get_offset(p, &p->instance_id_float)); + get_offset(p, &p->instance_id)); } if (linear && p->nr_buffer_varients == 1) { return p->idx_EBX; @@ -587,14 +584,6 @@ static boolean build_vertex_emit( struct translate_sse *p, x86_mov(p->func, x86_make_disp(p->machine_EDX, get_offset(p, &p->instance_id)), p->tmp_EAX); - - /* XXX: temporary */ - x86_mov(p->func, - p->tmp_EAX, - x86_fn_arg(p->func, 6)); - x86_mov(p->func, - x86_make_disp(p->machine_EDX, get_offset(p, &p->instance_id_float)), - p->tmp_EAX); } /* Get vertex count, compare to zero @@ -715,8 +704,7 @@ static void PIPE_CDECL translate_sse_run_elts( struct translate *translate, elts, count, instance_id, - output_buffer, - (float)instance_id ); + output_buffer); } static void PIPE_CDECL translate_sse_run( struct translate *translate, @@ -731,8 +719,7 @@ static void PIPE_CDECL translate_sse_run( struct translate *translate, start, count, instance_id, - output_buffer, - (float)instance_id); + output_buffer); } -- 2.30.2