diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2007-11-25 13:00:15 +1100 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2007-11-25 13:00:15 +1100 |
commit | 2bd97ca9427bbb90c1ac81f8947d33dba4b86290 (patch) | |
tree | e45cc99e45af12c4d05951a0ca17fc26ec634f68 /src | |
parent | 2a2756a019ecdd5406ef84019610a0016868a39b (diff) | |
parent | 7043db677f457ae9a46f2585a5ef52bf69a4e8ea (diff) |
Merge branch 'upstream-gallium-0.1' into darktama-gallium-0.1
Diffstat (limited to 'src')
68 files changed, 1396 insertions, 1846 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c index ed223977e2..49e04d81ec 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c @@ -307,6 +307,20 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch) } +void +intel_batchbuffer_finish(struct intel_batchbuffer *batch) +{ + struct _DriFenceObject *fence = intel_batchbuffer_flush(batch); + if (fence) { + driFenceReference(fence); + driFenceFinish(fence, + DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, + GL_FALSE); + driFenceUnReference(fence); + } +} + + /* This is the only way buffers get added to the validate list. */ boolean diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h index 2c943e68e5..82feafa21f 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h @@ -72,6 +72,8 @@ struct intel_batchbuffer *intel_batchbuffer_alloc(struct intel_context *intel); void intel_batchbuffer_free(struct intel_batchbuffer *batch); +void intel_batchbuffer_finish(struct intel_batchbuffer *batch); + struct _DriFenceObject *intel_batchbuffer_flush(struct intel_batchbuffer *batch); diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys.h b/src/mesa/drivers/dri/intel_winsys/intel_winsys.h index f944cd23c3..89e63e0a79 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_winsys.h +++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys.h @@ -32,9 +32,7 @@ struct intel_context; struct pipe_context; struct pipe_winsys; struct pipe_buffer_handle; -struct pipe_fence; struct _DriBufferObject; -struct _DriFenceObject; struct pipe_winsys * intel_create_pipe_winsys( int fd ); @@ -68,20 +66,5 @@ pipe_bo( struct _DriBufferObject *bo ) } -/* Turn the pipe opaque buffer pointer into a dri_bufmgr opaque - * buffer pointer... - */ -static INLINE struct _DriFenceObject * -dri_fo( struct pipe_fence *bo ) -{ - return (struct _DriFenceObject *)bo; -} - -static INLINE struct pipe_fence * -pipe_fo( struct _DriFenceObject *bo ) -{ - return (struct pipe_fence *)bo; -} - #endif diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c b/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c index d73b309fd4..8e0eea4392 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c @@ -111,62 +111,19 @@ static void intel_i915_batch_reloc( struct i915_winsys *sws, -static void -intel_i915_batch_flush( struct i915_winsys *sws, - struct pipe_fence **fence ) +static void intel_i915_batch_flush( struct i915_winsys *sws ) { struct intel_context *intel = intel_i915_winsys(sws)->intel; - struct pipe_fence *tmp_fence; - - tmp_fence = pipe_fo(intel_batchbuffer_flush( intel->batch )); - - /* this also increases the fence reference count, which is not done inside - * intel_batchbuffer_flush call above - */ - sws->fence_reference(sws, fence, tmp_fence); -} - -static void -intel_i915_fence_reference( struct i915_winsys *sws, - struct pipe_fence **dst_fence, - struct pipe_fence *src_fence ) -{ - struct _DriFenceObject **dri_dst_fence = (struct _DriFenceObject **)dst_fence; - struct _DriFenceObject *dri_src_fence = (struct _DriFenceObject *)src_fence; - - if(dri_src_fence) - driFenceReference(dri_src_fence); - - if(*dri_dst_fence) - driFenceUnReference(*dri_dst_fence); - - *dri_dst_fence = dri_src_fence; + intel_batchbuffer_flush( intel->batch ); +// if (0) intel_i915_batch_wait_idle( sws ); } -static int -intel_i915_fence_is_signalled( struct i915_winsys *sws, - struct pipe_fence *fence ) +static void intel_i915_batch_finish( struct i915_winsys *sws ) { - struct _DriFenceObject *dri_fence = dri_fo(fence); - if (fence) - return driFenceSignaled(dri_fence, - DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW); - return 1; -} - - -static int -intel_i915_fence_wait( struct i915_winsys *sws, - struct pipe_fence *fence ) -{ - struct _DriFenceObject *dri_fence = dri_fo(fence); - if (fence) - driFenceFinish(dri_fence, - DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, - GL_FALSE); - return 1; + struct intel_context *intel = intel_i915_winsys(sws)->intel; + intel_batchbuffer_finish( intel->batch ); } @@ -186,10 +143,7 @@ intel_create_i915simple( struct intel_context *intel, iws->winsys.batch_dword = intel_i915_batch_dword; iws->winsys.batch_reloc = intel_i915_batch_reloc; iws->winsys.batch_flush = intel_i915_batch_flush; - iws->winsys.fence_reference = intel_i915_fence_reference; - iws->winsys.fence_is_signalled = intel_i915_fence_is_signalled; - iws->winsys.fence_wait = intel_i915_fence_wait; - + iws->winsys.batch_finish = intel_i915_batch_finish; iws->intel = intel; /* Create the i915simple context: diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c index bc62d422a4..e4c257a0ee 100644 --- a/src/mesa/pipe/draw/draw_clip.c +++ b/src/mesa/pipe/draw/draw_clip.c @@ -128,12 +128,8 @@ static void interp( const struct clipper *clip, /* Other attributes * Note: start at 1 to skip winpos (data[0]) since we just computed * it above. - * Subtract two from nr_attrs since the first two attribs (always - * VF_ATTRIB_VERTEX_HEADER and VF_ATTRIB_CLIP_POS, see - * draw_set_vertex_attributes()) are in the vertex_header struct, - * not in the data[] array. */ - for (j = 1; j < nr_attrs - 2; j++) { + for (j = 1; j < nr_attrs; j++) { interp_attr(dst->data[j], t, in->data[j], out->data[j]); } } @@ -352,12 +348,8 @@ do_clip_line( struct draw_stage *stage, static void clip_begin( struct draw_stage *stage ) { - /* sanity checks. If these fail, review the clip/interp code! */ - assert(stage->draw->vertex_info.num_attribs >= 3); -#if 0 - assert(stage->draw->vertex_info.slot_to_attrib[0] == TGSI_ATTRIB_VERTEX_HEADER); - assert(stage->draw->vertex_info.slot_to_attrib[1] == TGSI_ATTRIB_CLIP_POS); -#endif + /* should always have position, at least */ + assert(stage->draw->vertex_info.num_attribs >= 1); stage->next->begin( stage->next ); } diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c index 3b22c01b34..d46e53f2be 100644 --- a/src/mesa/pipe/draw/draw_flatshade.c +++ b/src/mesa/pipe/draw/draw_flatshade.c @@ -60,8 +60,9 @@ static INLINE void copy_colors( struct draw_stage *stage, uint i; /* Look for constant/flat attribs and duplicate from src to dst vertex */ - for (i = 1; i < num_attribs - 2; i++) { - if (interp[i + 2] == INTERP_CONSTANT) { + /* skip attrib[0] which is vert pos */ + for (i = 1; i < num_attribs; i++) { + if (interp[i] == INTERP_CONSTANT) { copy_attr( i, dst, src ); } } diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/mesa/pipe/draw/draw_prim.c index e4a65b9f24..f8fc23b510 100644 --- a/src/mesa/pipe/draw/draw_prim.c +++ b/src/mesa/pipe/draw/draw_prim.c @@ -61,7 +61,7 @@ static void draw_prim_queue_flush( struct draw_context *draw ) unsigned i; if (0) - printf("Flushing with %d prims, %d verts\n", + fprintf(stdout,"Flushing with %d prims, %d verts\n", draw->pq.queue_nr, draw->vs.queue_nr); /* Make sure all vertices are available/shaded: diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 09acf69623..53d7451113 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -47,7 +47,7 @@ #include "draw_vertex.h" #include "x86/rtasm/x86sse.h" -#include "pipe/tgsi/exec/tgsi_core.h" +#include "pipe/tgsi/exec/tgsi_exec.h" struct gallivm_prog; diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/mesa/pipe/draw/draw_vbuf.c new file mode 100644 index 0000000000..d00cdec56c --- /dev/null +++ b/src/mesa/pipe/draw/draw_vbuf.c @@ -0,0 +1,399 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * \file + * Vertex buffer drawing stage. + * + * \author José Fonseca <jrfonsec@tungstengraphics.com> + * \author Keith Whitwell <keith@tungstengraphics.com> + */ + + +#include <assert.h> + +#include "pipe/draw/draw_vbuf.h" +#include "pipe/draw/draw_private.h" +#include "pipe/draw/draw_vertex.h" +#include "pipe/p_util.h" + + +/** + * Vertex buffer emit stage. + */ +struct vbuf_stage { + struct draw_stage stage; /**< This must be first (base class) */ + + struct vbuf_render *render; + + /** Vertex size in bytes */ + unsigned vertex_size; + + /* FIXME: we have no guarantee that 'unsigned' is 32bit */ + + /** Vertices in hardware format */ + unsigned *vertices; + unsigned *vertex_ptr; + unsigned max_vertices; + unsigned nr_vertices; + + /** Indices */ + ushort *indices; + unsigned max_indices; + unsigned nr_indices; + + /** Pipe primitive */ + unsigned prim; +}; + + +/** + * Basically a cast wrapper. + */ +static INLINE struct vbuf_stage * +vbuf_stage( struct draw_stage *stage ) +{ + assert(stage); + return (struct vbuf_stage *)stage; +} + + +static void vbuf_flush_indices( struct draw_stage *stage ); +static void vbuf_flush_vertices( struct draw_stage *stage, + unsigned new_vertex_size ); + + +static INLINE boolean +overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz ) +{ + unsigned long used = (unsigned long) ((char *)ptr - (char *)map); + return (used + bytes) > bufsz; +} + + +static INLINE void +check_space( struct vbuf_stage *vbuf, unsigned nr ) +{ + if (vbuf->nr_vertices + nr > vbuf->max_vertices ) + vbuf_flush_vertices(&vbuf->stage, vbuf->vertex_size ); + + if (vbuf->nr_indices + nr > vbuf->max_indices ) + vbuf_flush_indices(&vbuf->stage); +} + + +/** + * Extract the needed fields from vertex_header and emit i915 dwords. + * Recall that the vertices are constructed by the 'draw' module and + * have a couple of slots at the beginning (1-dword header, 4-dword + * clip pos) that we ignore here. + */ +static INLINE void +emit_vertex( struct vbuf_stage *vbuf, + struct vertex_header *vertex ) +{ + const struct vertex_info *vinfo = vbuf->render->get_vertex_info(vbuf->render); + + uint i; + uint count = 0; /* for debug/sanity */ + +// fprintf(stderr, "emit vertex %d to %p\n", +// vbuf->nr_vertices, vbuf->vertex_ptr); + + if(vertex->vertex_id != UNDEFINED_VERTEX_ID) { + if(vertex->vertex_id < vbuf->nr_vertices) + return; + else + fprintf(stderr, "Bad vertex id 0x%04x (>= 0x%04x)\n", + vertex->vertex_id, vbuf->nr_vertices); + return; + } + + vertex->vertex_id = vbuf->nr_vertices++; + + for (i = 0; i < vinfo->num_attribs; i++) { + switch (vinfo->format[i]) { + case FORMAT_OMIT: + /* no-op */ + break; + case FORMAT_1F: + *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); + count++; + break; + case FORMAT_2F: + *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); + *vbuf->vertex_ptr++ = fui(vertex->data[i][1]); + count += 2; + break; + case FORMAT_3F: + *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); + *vbuf->vertex_ptr++ = fui(vertex->data[i][1]); + *vbuf->vertex_ptr++ = fui(vertex->data[i][2]); + count += 3; + break; + case FORMAT_4F: + *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); + *vbuf->vertex_ptr++ = fui(vertex->data[i][1]); + *vbuf->vertex_ptr++ = fui(vertex->data[i][2]); + *vbuf->vertex_ptr++ = fui(vertex->data[i][3]); + count += 4; + break; + case FORMAT_4UB: + *vbuf->vertex_ptr++ = pack_ub4(float_to_ubyte( vertex->data[i][2] ), + float_to_ubyte( vertex->data[i][1] ), + float_to_ubyte( vertex->data[i][0] ), + float_to_ubyte( vertex->data[i][3] )); + count += 1; + break; + default: + assert(0); + } + } + assert(count == vinfo->size); +} + + +static void +vbuf_tri( struct draw_stage *stage, + struct prim_header *prim ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + unsigned i; + + check_space( vbuf, 3 ); + + for (i = 0; i < 3; i++) { + emit_vertex( vbuf, prim->v[i] ); + + vbuf->indices[vbuf->nr_indices++] = (ushort) prim->v[i]->vertex_id; + } +} + + +static void +vbuf_line( struct draw_stage *stage, + struct prim_header *prim ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + unsigned i; + + check_space( vbuf, 2 ); + + for (i = 0; i < 2; i++) { + emit_vertex( vbuf, prim->v[i] ); + + vbuf->indices[vbuf->nr_indices++] = (ushort) prim->v[i]->vertex_id; + } +} + + +static void +vbuf_point( struct draw_stage *stage, + struct prim_header *prim ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + check_space( vbuf, 1 ); + + emit_vertex( vbuf, prim->v[0] ); + + vbuf->indices[vbuf->nr_indices++] = (ushort) prim->v[0]->vertex_id; +} + + +static void +vbuf_first_tri( struct draw_stage *stage, + struct prim_header *prim ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + vbuf_flush_indices( stage ); + stage->tri = vbuf_tri; + stage->tri( stage, prim ); + vbuf->prim = PIPE_PRIM_TRIANGLES; + vbuf->render->set_primitive(vbuf->render, PIPE_PRIM_TRIANGLES); +} + + +static void +vbuf_first_line( struct draw_stage *stage, + struct prim_header *prim ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + vbuf_flush_indices( stage ); + stage->line = vbuf_line; + stage->line( stage, prim ); + vbuf->prim = PIPE_PRIM_LINES; + vbuf->render->set_primitive(vbuf->render, PIPE_PRIM_LINES); +} + + +static void +vbuf_first_point( struct draw_stage *stage, + struct prim_header *prim ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + vbuf_flush_indices( stage ); + stage->point = vbuf_point; + stage->point( stage, prim ); + vbuf->prim = PIPE_PRIM_POINTS; + vbuf->render->set_primitive(vbuf->render, PIPE_PRIM_POINTS); +} + + +static void +vbuf_flush_indices( struct draw_stage *stage ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + if(!vbuf->nr_indices) + return; + + assert(vbuf->vertex_ptr - vbuf->vertices == + vbuf->nr_vertices * vbuf->vertex_size / sizeof(unsigned)); + + switch(vbuf->prim) { + case PIPE_PRIM_POINTS: + break; + case PIPE_PRIM_LINES: + assert(vbuf->nr_indices % 2 == 0); + break; + case PIPE_PRIM_TRIANGLES: + assert(vbuf->nr_indices % 3 == 0); + break; + default: + assert(0); + } + + vbuf->render->draw(vbuf->render, vbuf->indices, vbuf->nr_indices); + + vbuf->nr_indices = 0; +} + + +/** + * Flush existing vertex buffer and allocate a new one. + * + * XXX: We separate flush-on-index-full and flush-on-vb-full, but may + * raise issues uploading vertices if the hardware wants to flush when + * we flush. + */ +static void +vbuf_flush_vertices( struct draw_stage *stage, + unsigned new_vertex_size ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + if(vbuf->vertices) { + vbuf_flush_indices(stage); + + /* Reset temporary vertices ids */ + if(vbuf->nr_vertices) + draw_reset_vertex_ids( vbuf->stage.draw ); + + /* Free the vertex buffer */ + vbuf->render->release_vertices(vbuf->render, + vbuf->vertices, + vbuf->vertex_size, + vbuf->nr_vertices); + vbuf->nr_vertices = 0; + vbuf->vertex_ptr = vbuf->vertices = NULL; + + } + + assert(!vbuf->nr_indices); + + /* Allocate a new vertex buffer */ + vbuf->vertex_size = new_vertex_size; + vbuf->max_vertices = vbuf->render->max_vertex_buffer_bytes / vbuf->vertex_size; + vbuf->vertices = vbuf->render->allocate_vertices(vbuf->render, + vbuf->vertex_size, + vbuf->max_vertices) ; + vbuf->vertex_ptr = vbuf->vertices; +} + + +static void +vbuf_begin( struct draw_stage *stage ) +{ + struct vbuf_stage *vbuf = vbuf_stage(stage); + const struct vertex_info *vinfo = vbuf->render->get_vertex_info(vbuf->render); + unsigned vertex_size = vinfo->size * sizeof(float); + + if(vbuf->vertex_size != vertex_size) + vbuf_flush_vertices(&vbuf->stage, vertex_size); +} + + +static void +vbuf_end( struct draw_stage *stage ) +{ + /* XXX: Overkill */ + vbuf_flush_indices( stage ); + + stage->point = vbuf_first_point; + stage->line = vbuf_first_line; + stage->tri = vbuf_first_tri; +} + + +static void +vbuf_reset_stipple_counter( struct draw_stage *stage ) +{ +} + + +/** + * Create a new primitive vbuf/render stage. + */ +struct draw_stage *draw_vbuf_stage( struct draw_context *draw, + struct vbuf_render *render ) +{ + struct vbuf_stage *vbuf = CALLOC_STRUCT(vbuf_stage); + + vbuf->stage.draw = draw; + vbuf->stage.begin = vbuf_begin; + vbuf->stage.point = vbuf_first_point; + vbuf->stage.line = vbuf_first_line; + vbuf->stage.tri = vbuf_first_tri; + vbuf->stage.end = vbuf_end; + vbuf->stage.reset_stipple_counter = vbuf_reset_stipple_counter; + + vbuf->render = render; + + assert(render->max_indices < UNDEFINED_VERTEX_ID); + vbuf->max_indices = render->max_indices; + /* FIXME: free this memory on takedown */ + vbuf->indices = MALLOC( vbuf->max_indices ); + + vbuf->vertices = NULL; + vbuf->vertex_ptr = vbuf->vertices; + + return &vbuf->stage; +} diff --git a/src/mesa/pipe/draw/draw_vbuf.h b/src/mesa/pipe/draw/draw_vbuf.h new file mode 100644 index 0000000000..43aa740f64 --- /dev/null +++ b/src/mesa/pipe/draw/draw_vbuf.h @@ -0,0 +1,106 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * \file + * Vertex buffer drawing stage. + * + * \author Keith Whitwell <keith@tungstengraphics.com> + * \author José Fonseca <jrfonsec@tungstengraphics.com> + */ + +#ifndef DRAW_VBUF_H_ +#define DRAW_VBUF_H_ + + +#include "pipe/p_util.h" + + +struct draw_context; +struct vertex_info; + + +/** + * Interface for hardware vertex buffer rendering. + */ +struct vbuf_render { + + /** + * Driver limits. May be tuned lower to improve cache hits on + * index list. + */ + unsigned max_indices; + unsigned max_vertex_buffer_bytes; + + /** + * Get the hardware vertex format. + * + * XXX: have this in draw_context instead? + */ + const struct vertex_info *(*get_vertex_info)( struct vbuf_render * ); + + /** + * Request a destination for vertices. + * Hardware renderers will use ttm memory, others will just malloc + * something. + */ + void *(*allocate_vertices)( struct vbuf_render *, + ushort vertex_size, + ushort nr_vertices ); + + /** + * Notify the renderer of the current primitive when it changes. + * Prim is restricted to TRIANGLES, LINES and POINTS. + */ + void (*set_primitive)( struct vbuf_render *, unsigned prim ); + + /** + * DrawElements, note indices are ushort: + */ + void (*draw)( struct vbuf_render *, + const ushort *indices, + unsigned nr_indices ); + + /** + * Called when vbuf is done with this set of vertices: + */ + void (*release_vertices)( struct vbuf_render *, + void *vertices, + unsigned vertex_size, + unsigned vertices_used ); + + void (*destroy)( struct vbuf_render * ); +}; + + + +struct draw_stage * +draw_vbuf_stage( struct draw_context *draw, + struct vbuf_render *render ); + + +#endif /*DRAW_VBUF_H_*/ diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/mesa/pipe/draw/draw_vertex.c index dea26a3d0a..a1926d951a 100644 --- a/src/mesa/pipe/draw/draw_vertex.c +++ b/src/mesa/pipe/draw/draw_vertex.c @@ -75,7 +75,6 @@ draw_compute_vertex_size(struct vertex_info *vinfo) vinfo->size += 3; break; case FORMAT_4F: - case FORMAT_4F_VIEWPORT: vinfo->size += 4; break; default: @@ -88,38 +87,26 @@ draw_compute_vertex_size(struct vertex_info *vinfo) /** - * Tell the drawing module about the layout of post-transformation vertices + * Tell the drawing module about the contents of post-transformation vertices. + * Note that the vertex attribute format info isn't used by 'draw'; all + * attributes are handled as float[4]. But when the driver emits vertices + * it'll use that info. + * We _do_ care about the number of attributes and their interpolation modes. */ void -draw_set_vertex_attributes( struct draw_context *draw, - const uint *slot_to_vf_attr, - const enum interp_mode *interps, - unsigned nr_attrs ) +draw_set_vertex_info( struct draw_context *draw, + const struct vertex_info *info) { - struct vertex_info *vinfo = &draw->vertex_info; - unsigned i; + assert(info->interp_mode[0] == INTERP_LINEAR); /* should be vert pos */ + assert(info->num_attribs <= PIPE_MAX_SHADER_OUTPUTS); -#if 0 - assert(slot_to_vf_attr[0] == TGSI_ATTRIB_POS); -#endif + memcpy(&draw->vertex_info, info, sizeof(*info)); - memset(vinfo, 0, sizeof(*vinfo)); - - /* - * First three attribs are always the same: header, clip pos, winpos - */ - emit_vertex_attr(vinfo, FORMAT_1F, INTERP_NONE); - emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR); - emit_vertex_attr(vinfo, FORMAT_4F_VIEWPORT, INTERP_LINEAR); - - /* - * Remaining attribs (color, texcoords, etc) + /* Need to know vertex size (in words) for vertex copying elsewhere. + * Four words per attribute, plus vertex header (uint) and clip + * position (float[4]). */ - for (i = 1; i < nr_attrs; i++) { - emit_vertex_attr(vinfo, FORMAT_4F, interps[i]); - } - - draw_compute_vertex_size(vinfo); + draw->vertex_info.size = draw->vertex_info.num_attribs * 4 + 5; } diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h index a1fa7aae5a..8bb328affa 100644 --- a/src/mesa/pipe/draw/draw_vertex.h +++ b/src/mesa/pipe/draw/draw_vertex.h @@ -46,7 +46,6 @@ enum attrib_format { FORMAT_2F, FORMAT_3F, FORMAT_4F, - FORMAT_4F_VIEWPORT, FORMAT_4UB }; @@ -93,10 +92,8 @@ draw_emit_vertex_attr(struct vertex_info *vinfo, } -extern void draw_set_vertex_attributes( struct draw_context *draw, - const uint *attrs, - const enum interp_mode *interps, - unsigned nr_attrs ); +extern void draw_set_vertex_info( struct draw_context *draw, + const struct vertex_info *info); extern void draw_set_twoside_attributes(struct draw_context *draw, uint front0, uint back0, diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c index b510a4dbba..5510b3674e 100644 --- a/src/mesa/pipe/draw/draw_vertex_fetch.c +++ b/src/mesa/pipe/draw/draw_vertex_fetch.c @@ -31,12 +31,11 @@ */ #include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" #include "draw_private.h" #include "draw_context.h" #include "draw_vertex.h" -#include "pipe/tgsi/exec/tgsi_core.h" - #define DBG 0 @@ -80,6 +79,13 @@ fetch_attrib4(const void *ptr, unsigned format, float attrib[4]) attrib[0] = (float) ((int *) ptr)[0]; break; + case PIPE_FORMAT_U_A8_R8_G8_B8: + attrib[0] = (float) ((unsigned char *) ptr)[2] / 255.0f; + attrib[1] = (float) ((unsigned char *) ptr)[1] / 255.0f; + attrib[2] = (float) ((unsigned char *) ptr)[0] / 255.0f; + attrib[3] = (float) ((unsigned char *) ptr)[3] / 255.0f; + break; + default: assert(0); } diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index e8801addac..eef71a7a4a 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -32,13 +32,13 @@ */ #include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" #include "draw_private.h" #include "draw_context.h" #include "draw_vertex.h" #include "x86/rtasm/x86sse.h" -#include "pipe/tgsi/exec/tgsi_core.h" #include "pipe/llvm/gallivm.h" @@ -158,10 +158,8 @@ run_vertex_program(struct draw_context *draw, #endif /* Remaining attributes are packed into sequential post-transform * vertex attrib slots. - * Skip 0 since we just did it above. - * Subtract two because of the VERTEX_HEADER, CLIP_POS attribs. */ - for (slot = 1; slot < draw->vertex_info.num_attribs - 2; slot++) { + for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) { vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j]; diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c index 3e005a76f3..53a1776ffc 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c +++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c @@ -173,10 +173,8 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) /* Remaining attributes are packed into sequential post-transform * vertex attrib slots. - * Skip 0 since we just did it above. - * Subtract two because of the VERTEX_HEADER, CLIP_POS attribs. */ - for (slot = 1; slot < draw->vertex_info.num_attribs - 2; slot++) { + for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) { vOut->data[slot][0] = dests[slot][0]; vOut->data[slot][1] = dests[slot][1]; vOut->data[slot][2] = dests[slot][2]; diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c index f3b4478f9a..494a2bc619 100644 --- a/src/mesa/pipe/draw/draw_wide_prims.c +++ b/src/mesa/pipe/draw/draw_wide_prims.c @@ -30,10 +30,10 @@ #include "pipe/p_util.h" #include "pipe/p_defines.h" +#include "pipe/p_shader_tokens.h" #include "draw_private.h" - struct wide_stage { struct draw_stage stage; diff --git a/src/mesa/pipe/i915simple/i915_batch.h b/src/mesa/pipe/i915simple/i915_batch.h index 603d193f62..fb88cd6db0 100644 --- a/src/mesa/pipe/i915simple/i915_batch.h +++ b/src/mesa/pipe/i915simple/i915_batch.h @@ -44,11 +44,11 @@ #define ADVANCE_BATCH() -#define FLUSH_BATCH() do { \ - if (0) i915_dump_batchbuffer( i915 ); \ - i915->winsys->batch_flush( i915->winsys, &i915->last_fence ); \ - i915->batch_start = NULL; \ - i915->hardware_dirty = ~0; \ +#define FLUSH_BATCH() do { \ + if (0) i915_dump_batchbuffer( i915 ); \ + i915->winsys->batch_flush( i915->winsys ); \ + i915->batch_start = NULL; \ + i915->hardware_dirty = ~0; \ } while (0) #endif diff --git a/src/mesa/pipe/i915simple/i915_blit.c b/src/mesa/pipe/i915simple/i915_blit.c index a1f953ebbe..6e95313a0d 100644 --- a/src/mesa/pipe/i915simple/i915_blit.c +++ b/src/mesa/pipe/i915simple/i915_blit.c @@ -47,7 +47,7 @@ i915_fill_blit(struct i915_context *i915, unsigned BR13, CMD; BATCH_LOCALS; - dst_pitch *= cpp; + dst_pitch *= (short) cpp; switch (cpp) { case 1: @@ -102,14 +102,14 @@ i915_copy_blit( struct i915_context *i915, BATCH_LOCALS; - DBG(i915, + I915_DBG(i915, "%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", __FUNCTION__, src_buffer, src_pitch, src_offset, src_x, src_y, dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h); - src_pitch *= cpp; - dst_pitch *= cpp; + src_pitch *= (short) cpp; + dst_pitch *= (short) cpp; switch (cpp) { case 1: diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index f5d770ce0d..a0ed3032b1 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -175,9 +175,7 @@ static void i915_destroy( struct pipe_context *pipe ) draw_destroy( i915->draw ); - i915->winsys->fence_reference( i915->winsys, &i915->last_fence, NULL ); - - free( i915 ); + FREE( i915 ); } @@ -343,7 +341,7 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys, */ i915->draw = draw_create(); assert(i915->draw); - if (getenv("I915_VBUF")) { + if (GETENV("I915_VBUF")) { draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915)); } else { diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h index 488682f852..ee430ebc90 100644 --- a/src/mesa/pipe/i915simple/i915_context.h +++ b/src/mesa/pipe/i915simple/i915_context.h @@ -80,7 +80,6 @@ -struct pipe_fence; struct i915_cache_context; /* Use to calculate differences between state emitted to hardware and @@ -185,8 +184,6 @@ struct i915_context unsigned dirty; unsigned *batch_start; - - struct pipe_fence *last_fence; /** Vertex buffer */ struct pipe_buffer_handle *vbo; diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/mesa/pipe/i915simple/i915_debug.c index d07d2f1fa9..94db44e1aa 100644 --- a/src/mesa/pipe/i915simple/i915_debug.c +++ b/src/mesa/pipe/i915simple/i915_debug.c @@ -33,7 +33,21 @@ #include "i915_debug.h" #include "pipe/p_winsys.h" -#define PRINTF( ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ ) + +static void +PRINTF( + struct debug_stream *stream, + const char *fmt, + ... ) +{ + va_list args; + char buffer[256]; + + va_start( args, fmt ); + vsprintf( buffer, fmt, args ); + stream->winsys->printf( stream->winsys, buffer ); + va_end( args ); +} static boolean debug( struct debug_stream *stream, const char *name, unsigned len ) @@ -42,19 +56,19 @@ static boolean debug( struct debug_stream *stream, const char *name, unsigned le unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); if (len == 0) { - PRINTF("Error - zero length packet (0x%08x)\n", stream->ptr[0]); + PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]); assert(0); return FALSE; } if (stream->print_addresses) - PRINTF("%08x: ", stream->offset); + PRINTF(stream, "%08x: ", stream->offset); - PRINTF("%s (%d dwords):\n", name, len); + PRINTF(stream, "%s (%d dwords):\n", name, len); for (i = 0; i < len; i++) - PRINTF("\t0x%08x\n", ptr[i]); - PRINTF("\n"); + PRINTF(stream, "\t0x%08x\n", ptr[i]); + PRINTF(stream, "\n"); stream->offset += len * sizeof(unsigned); @@ -91,17 +105,17 @@ static boolean debug_prim( struct debug_stream *stream, const char *name, - PRINTF("%s %s (%d dwords):\n", name, prim, len); - PRINTF("\t0x%08x\n", ptr[0]); + PRINTF(stream, "%s %s (%d dwords):\n", name, prim, len); + PRINTF(stream, "\t0x%08x\n", ptr[0]); for (i = 1; i < len; i++) { if (dump_floats) - PRINTF("\t0x%08x // %f\n", ptr[i], *(float *)&ptr[i]); + PRINTF(stream, "\t0x%08x // %f\n", ptr[i], *(float *)&ptr[i]); else - PRINTF("\t0x%08x\n", ptr[i]); + PRINTF(stream, "\t0x%08x\n", ptr[i]); } - PRINTF("\n"); + PRINTF(stream, "\n"); stream->offset += len * sizeof(unsigned); @@ -116,15 +130,15 @@ static boolean debug_program( struct debug_stream *stream, const char *name, uns unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); if (len == 0) { - PRINTF("Error - zero length packet (0x%08x)\n", stream->ptr[0]); + PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]); assert(0); return FALSE; } if (stream->print_addresses) - PRINTF("%08x: ", stream->offset); + PRINTF(stream, "%08x: ", stream->offset); - PRINTF("%s (%d dwords):\n", name, len); + PRINTF(stream, "%s (%d dwords):\n", name, len); i915_disassemble_program( stream, ptr, len ); stream->offset += len * sizeof(unsigned); @@ -138,17 +152,17 @@ static boolean debug_chain( struct debug_stream *stream, const char *name, unsig unsigned old_offset = stream->offset + len * sizeof(unsigned); unsigned i; - PRINTF("%s (%d dwords):\n", name, len); + PRINTF(stream, "%s (%d dwords):\n", name, len); for (i = 0; i < len; i++) - PRINTF("\t0x%08x\n", ptr[i]); + PRINTF(stream, "\t0x%08x\n", ptr[i]); stream->offset = ptr[1] & ~0x3; if (stream->offset < old_offset) - PRINTF("\n... skipping backwards from 0x%x --> 0x%x ...\n\n", + PRINTF(stream, "\n... skipping backwards from 0x%x --> 0x%x ...\n\n", old_offset, stream->offset ); else - PRINTF("\n... skipping from 0x%x --> 0x%x ...\n\n", + PRINTF(stream, "\n... skipping from 0x%x --> 0x%x ...\n\n", old_offset, stream->offset ); @@ -168,23 +182,38 @@ static boolean debug_variable_length_prim( struct debug_stream *stream ) len = 1+(i+2)/2; - PRINTF("3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len); + PRINTF(stream, "3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len); for (i = 0; i < len; i++) - PRINTF("\t0x%08x\n", ptr[i]); - PRINTF("\n"); + PRINTF(stream, "\t0x%08x\n", ptr[i]); + PRINTF(stream, "\n"); stream->offset += len * sizeof(unsigned); return TRUE; } -#define BITS( dw, hi, lo, ... ) \ -do { \ - unsigned himask = ~0UL >> (31 - (hi)); \ - PRINTF("\t\t "); \ - PRINTF(__VA_ARGS__); \ - PRINTF(": 0x%x\n", ((dw) & himask) >> (lo)); \ -} while (0) +static void +BITS( + struct debug_stream *stream, + unsigned dw, + unsigned hi, + unsigned lo, + const char *fmt, + ... ) +{ + va_list args; + char buffer[256]; + unsigned himask = ~0UL >> (31 - (hi)); + + PRINTF(stream, "\t\t "); + + va_start( args, fmt ); + vsprintf( buffer, fmt, args ); + stream->winsys->printf( stream->winsys, buffer ); + va_end( args ); + + PRINTF(stream, ": 0x%x\n", ((dw) & himask) >> (lo)); +} #define MBZ( dw, hi, lo) do { \ unsigned x = (dw) >> (lo); \ @@ -194,14 +223,28 @@ do { \ assert ((x & himask & ~lomask) == 0); \ } while (0) -#define FLAG( dw, bit, ... ) \ -do { \ - if (((dw) >> (bit)) & 1) { \ - PRINTF("\t\t "); \ - PRINTF(__VA_ARGS__); \ - PRINTF("\n"); \ - } \ -} while (0) +static void +FLAG( + struct debug_stream *stream, + unsigned dw, + unsigned bit, + const char *fmt, + ... ) +{ + if (((dw) >> (bit)) & 1) { + va_list args; + char buffer[256]; + + PRINTF(stream, "\t\t "); + + va_start( args, fmt ); + vsprintf( buffer, fmt, args ); + stream->winsys->printf( stream->winsys, buffer ); + va_end( args ); + + PRINTF(stream, "\n"); + } +} static boolean debug_load_immediate( struct debug_stream *stream, const char *name, @@ -211,95 +254,95 @@ static boolean debug_load_immediate( struct debug_stream *stream, unsigned bits = (ptr[0] >> 4) & 0xff; unsigned j = 0; - PRINTF("%s (%d dwords, flags: %x):\n", name, len, bits); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords, flags: %x):\n", name, len, bits); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); if (bits & (1<<0)) { - PRINTF("\t LIS0: 0x%08x\n", ptr[j]); - PRINTF("\t vb address: 0x%08x\n", (ptr[j] & ~0x3)); - BITS(ptr[j], 0, 0, "vb invalidate disable"); + PRINTF(stream, "\t LIS0: 0x%08x\n", ptr[j]); + PRINTF(stream, "\t vb address: 0x%08x\n", (ptr[j] & ~0x3)); + BITS(stream, ptr[j], 0, 0, "vb invalidate disable"); j++; } if (bits & (1<<1)) { - PRINTF("\t LIS1: 0x%08x\n", ptr[j]); - BITS(ptr[j], 29, 24, "vb dword width"); - BITS(ptr[j], 21, 16, "vb dword pitch"); - BITS(ptr[j], 15, 0, "vb max index"); + PRINTF(stream, "\t LIS1: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 29, 24, "vb dword width"); + BITS(stream, ptr[j], 21, 16, "vb dword pitch"); + BITS(stream, ptr[j], 15, 0, "vb max index"); j++; } if (bits & (1<<2)) { int i; - PRINTF("\t LIS2: 0x%08x\n", ptr[j]); + PRINTF(stream, "\t LIS2: 0x%08x\n", ptr[j]); for (i = 0; i < 8; i++) { unsigned tc = (ptr[j] >> (i * 4)) & 0xf; if (tc != 0xf) - BITS(tc, 3, 0, "tex coord %d", i); + BITS(stream, tc, 3, 0, "tex coord %d", i); } j++; } if (bits & (1<<3)) { - PRINTF("\t LIS3: 0x%08x\n", ptr[j]); + PRINTF(stream, "\t LIS3: 0x%08x\n", ptr[j]); j++; } if (bits & (1<<4)) { - PRINTF("\t LIS4: 0x%08x\n", ptr[j]); - BITS(ptr[j], 31, 23, "point width"); - BITS(ptr[j], 22, 19, "line width"); - FLAG(ptr[j], 18, "alpha flatshade"); - FLAG(ptr[j], 17, "fog flatshade"); - FLAG(ptr[j], 16, "spec flatshade"); - FLAG(ptr[j], 15, "rgb flatshade"); - BITS(ptr[j], 14, 13, "cull mode"); - FLAG(ptr[j], 12, "vfmt: point width"); - FLAG(ptr[j], 11, "vfmt: specular/fog"); - FLAG(ptr[j], 10, "vfmt: rgba"); - FLAG(ptr[j], 9, "vfmt: depth offset"); - BITS(ptr[j], 8, 6, "vfmt: position (2==xyzw)"); - FLAG(ptr[j], 5, "force dflt diffuse"); - FLAG(ptr[j], 4, "force dflt specular"); - FLAG(ptr[j], 3, "local depth offset enable"); - FLAG(ptr[j], 2, "vfmt: fp32 fog coord"); - FLAG(ptr[j], 1, "sprite point"); - FLAG(ptr[j], 0, "antialiasing"); + PRINTF(stream, "\t LIS4: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 23, "point width"); + BITS(stream, ptr[j], 22, 19, "line width"); + FLAG(stream, ptr[j], 18, "alpha flatshade"); + FLAG(stream, ptr[j], 17, "fog flatshade"); + FLAG(stream, ptr[j], 16, "spec flatshade"); + FLAG(stream, ptr[j], 15, "rgb flatshade"); + BITS(stream, ptr[j], 14, 13, "cull mode"); + FLAG(stream, ptr[j], 12, "vfmt: point width"); + FLAG(stream, ptr[j], 11, "vfmt: specular/fog"); + FLAG(stream, ptr[j], 10, "vfmt: rgba"); + FLAG(stream, ptr[j], 9, "vfmt: depth offset"); + BITS(stream, ptr[j], 8, 6, "vfmt: position (2==xyzw)"); + FLAG(stream, ptr[j], 5, "force dflt diffuse"); + FLAG(stream, ptr[j], 4, "force dflt specular"); + FLAG(stream, ptr[j], 3, "local depth offset enable"); + FLAG(stream, ptr[j], 2, "vfmt: fp32 fog coord"); + FLAG(stream, ptr[j], 1, "sprite point"); + FLAG(stream, ptr[j], 0, "antialiasing"); j++; } if (bits & (1<<5)) { - PRINTF("\t LIS5: 0x%08x\n", ptr[j]); - BITS(ptr[j], 31, 28, "rgba write disables"); - FLAG(ptr[j], 27, "force dflt point width"); - FLAG(ptr[j], 26, "last pixel enable"); - FLAG(ptr[j], 25, "global z offset enable"); - FLAG(ptr[j], 24, "fog enable"); - BITS(ptr[j], 23, 16, "stencil ref"); - BITS(ptr[j], 15, 13, "stencil test"); - BITS(ptr[j], 12, 10, "stencil fail op"); - BITS(ptr[j], 9, 7, "stencil pass z fail op"); - BITS(ptr[j], 6, 4, "stencil pass z pass op"); - FLAG(ptr[j], 3, "stencil write enable"); - FLAG(ptr[j], 2, "stencil test enable"); - FLAG(ptr[j], 1, "color dither enable"); - FLAG(ptr[j], 0, "logiop enable"); + PRINTF(stream, "\t LIS5: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 28, "rgba write disables"); + FLAG(stream, ptr[j], 27, "force dflt point width"); + FLAG(stream, ptr[j], 26, "last pixel enable"); + FLAG(stream, ptr[j], 25, "global z offset enable"); + FLAG(stream, ptr[j], 24, "fog enable"); + BITS(stream, ptr[j], 23, 16, "stencil ref"); + BITS(stream, ptr[j], 15, 13, "stencil test"); + BITS(stream, ptr[j], 12, 10, "stencil fail op"); + BITS(stream, ptr[j], 9, 7, "stencil pass z fail op"); + BITS(stream, ptr[j], 6, 4, "stencil pass z pass op"); + FLAG(stream, ptr[j], 3, "stencil write enable"); + FLAG(stream, ptr[j], 2, "stencil test enable"); + FLAG(stream, ptr[j], 1, "color dither enable"); + FLAG(stream, ptr[j], 0, "logiop enable"); j++; } if (bits & (1<<6)) { - PRINTF("\t LIS6: 0x%08x\n", ptr[j]); - FLAG(ptr[j], 31, "alpha test enable"); - BITS(ptr[j], 30, 28, "alpha func"); - BITS(ptr[j], 27, 20, "alpha ref"); - FLAG(ptr[j], 19, "depth test enable"); - BITS(ptr[j], 18, 16, "depth func"); - FLAG(ptr[j], 15, "blend enable"); - BITS(ptr[j], 14, 12, "blend func"); - BITS(ptr[j], 11, 8, "blend src factor"); - BITS(ptr[j], 7, 4, "blend dst factor"); - FLAG(ptr[j], 3, "depth write enable"); - FLAG(ptr[j], 2, "color write enable"); - BITS(ptr[j], 1, 0, "provoking vertex"); + PRINTF(stream, "\t LIS6: 0x%08x\n", ptr[j]); + FLAG(stream, ptr[j], 31, "alpha test enable"); + BITS(stream, ptr[j], 30, 28, "alpha func"); + BITS(stream, ptr[j], 27, 20, "alpha ref"); + FLAG(stream, ptr[j], 19, "depth test enable"); + BITS(stream, ptr[j], 18, 16, "depth func"); + FLAG(stream, ptr[j], 15, "blend enable"); + BITS(stream, ptr[j], 14, 12, "blend func"); + BITS(stream, ptr[j], 11, 8, "blend src factor"); + BITS(stream, ptr[j], 7, 4, "blend dst factor"); + FLAG(stream, ptr[j], 3, "depth write enable"); + FLAG(stream, ptr[j], 2, "color write enable"); + BITS(stream, ptr[j], 1, 0, "provoking vertex"); j++; } - PRINTF("\n"); + PRINTF(stream, "\n"); assert(j == len); @@ -318,34 +361,34 @@ static boolean debug_load_indirect( struct debug_stream *stream, unsigned bits = (ptr[0] >> 8) & 0x3f; unsigned i, j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); for (i = 0; i < 6; i++) { if (bits & (1<<i)) { switch (1<<(8+i)) { case LI0_STATE_STATIC_INDIRECT: - PRINTF(" STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; - PRINTF(" 0x%08x\n", ptr[j++]); + PRINTF(stream, " STATIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; + PRINTF(stream, " 0x%08x\n", ptr[j++]); break; case LI0_STATE_DYNAMIC_INDIRECT: - PRINTF(" DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; + PRINTF(stream, " DYNAMIC: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; break; case LI0_STATE_SAMPLER: - PRINTF(" SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; - PRINTF(" 0x%08x\n", ptr[j++]); + PRINTF(stream, " SAMPLER: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; + PRINTF(stream, " 0x%08x\n", ptr[j++]); break; case LI0_STATE_MAP: - PRINTF(" MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; - PRINTF(" 0x%08x\n", ptr[j++]); + PRINTF(stream, " MAP: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; + PRINTF(stream, " 0x%08x\n", ptr[j++]); break; case LI0_STATE_PROGRAM: - PRINTF(" PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; - PRINTF(" 0x%08x\n", ptr[j++]); + PRINTF(stream, " PROGRAM: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; + PRINTF(stream, " 0x%08x\n", ptr[j++]); break; case LI0_STATE_CONSTANTS: - PRINTF(" CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; - PRINTF(" 0x%08x\n", ptr[j++]); + PRINTF(stream, " CONSTANTS: 0x%08x | %x\n", ptr[j]&~3, ptr[j]&3); j++; + PRINTF(stream, " 0x%08x\n", ptr[j++]); break; default: assert(0); @@ -355,10 +398,10 @@ static boolean debug_load_indirect( struct debug_stream *stream, } if (bits == 0) { - PRINTF("\t DUMMY: 0x%08x\n", ptr[j++]); + PRINTF(stream, "\t DUMMY: 0x%08x\n", ptr[j++]); } - PRINTF("\n"); + PRINTF(stream, "\n"); assert(j == len); @@ -371,61 +414,61 @@ static boolean debug_load_indirect( struct debug_stream *stream, static void BR13( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x\n", val); - FLAG(val, 30, "clipping enable"); - BITS(val, 25, 24, "color depth (3==32bpp)"); - BITS(val, 23, 16, "raster op"); - BITS(val, 15, 0, "dest pitch"); + PRINTF(stream, "\t0x%08x\n", val); + FLAG(stream, val, 30, "clipping enable"); + BITS(stream, val, 25, 24, "color depth (3==32bpp)"); + BITS(stream, val, 23, 16, "raster op"); + BITS(stream, val, 15, 0, "dest pitch"); } static void BR22( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x\n", val); - BITS(val, 31, 16, "dest y1"); - BITS(val, 15, 0, "dest x1"); + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 31, 16, "dest y1"); + BITS(stream, val, 15, 0, "dest x1"); } static void BR23( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x\n", val); - BITS(val, 31, 16, "dest y2"); - BITS(val, 15, 0, "dest x2"); + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 31, 16, "dest y2"); + BITS(stream, val, 15, 0, "dest x2"); } static void BR09( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x -- dest address\n", val); + PRINTF(stream, "\t0x%08x -- dest address\n", val); } static void BR26( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x\n", val); - BITS(val, 31, 16, "src y1"); - BITS(val, 15, 0, "src x1"); + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 31, 16, "src y1"); + BITS(stream, val, 15, 0, "src x1"); } static void BR11( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x\n", val); - BITS(val, 15, 0, "src pitch"); + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 15, 0, "src pitch"); } static void BR12( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x -- src address\n", val); + PRINTF(stream, "\t0x%08x -- src address\n", val); } static void BR16( struct debug_stream *stream, unsigned val ) { - PRINTF("\t0x%08x -- color\n", val); + PRINTF(stream, "\t0x%08x -- color\n", val); } static boolean debug_copy_blit( struct debug_stream *stream, @@ -435,8 +478,8 @@ static boolean debug_copy_blit( struct debug_stream *stream, unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); int j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); BR13(stream, ptr[j++]); BR22(stream, ptr[j++]); @@ -458,8 +501,8 @@ static boolean debug_color_blit( struct debug_stream *stream, unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); int j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); BR13(stream, ptr[j++]); BR22(stream, ptr[j++]); @@ -479,13 +522,13 @@ static boolean debug_modes4( struct debug_stream *stream, unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); int j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j]); - BITS(ptr[j], 21, 18, "logicop func"); - FLAG(ptr[j], 17, "stencil test mask modify-enable"); - FLAG(ptr[j], 16, "stencil write mask modify-enable"); - BITS(ptr[j], 15, 8, "stencil test mask"); - BITS(ptr[j], 7, 0, "stencil write mask"); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 21, 18, "logicop func"); + FLAG(stream, ptr[j], 17, "stencil test mask modify-enable"); + FLAG(stream, ptr[j], 16, "stencil write mask modify-enable"); + BITS(stream, ptr[j], 15, 8, "stencil test mask"); + BITS(stream, ptr[j], 7, 0, "stencil write mask"); j++; stream->offset += len * sizeof(unsigned); @@ -498,44 +541,44 @@ static boolean debug_map_state( struct debug_stream *stream, unsigned len ) { unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - int j = 0; + unsigned j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); { - PRINTF("\t0x%08x\n", ptr[j]); - BITS(ptr[j], 15, 0, "map mask"); + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 15, 0, "map mask"); j++; } while (j < len) { { - PRINTF("\t TMn.0: 0x%08x\n", ptr[j]); - PRINTF("\t map address: 0x%08x\n", (ptr[j] & ~0x3)); - FLAG(ptr[j], 1, "vertical line stride"); - FLAG(ptr[j], 0, "vertical line stride offset"); + PRINTF(stream, "\t TMn.0: 0x%08x\n", ptr[j]); + PRINTF(stream, "\t map address: 0x%08x\n", (ptr[j] & ~0x3)); + FLAG(stream, ptr[j], 1, "vertical line stride"); + FLAG(stream, ptr[j], 0, "vertical line stride offset"); j++; } { - PRINTF("\t TMn.1: 0x%08x\n", ptr[j]); - BITS(ptr[j], 31, 21, "height"); - BITS(ptr[j], 20, 10, "width"); - BITS(ptr[j], 9, 7, "surface format"); - BITS(ptr[j], 6, 3, "texel format"); - FLAG(ptr[j], 2, "use fence regs"); - FLAG(ptr[j], 1, "tiled surface"); - FLAG(ptr[j], 0, "tile walk ymajor"); + PRINTF(stream, "\t TMn.1: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 21, "height"); + BITS(stream, ptr[j], 20, 10, "width"); + BITS(stream, ptr[j], 9, 7, "surface format"); + BITS(stream, ptr[j], 6, 3, "texel format"); + FLAG(stream, ptr[j], 2, "use fence regs"); + FLAG(stream, ptr[j], 1, "tiled surface"); + FLAG(stream, ptr[j], 0, "tile walk ymajor"); j++; } { - PRINTF("\t TMn.2: 0x%08x\n", ptr[j]); - BITS(ptr[j], 31, 21, "dword pitch"); - BITS(ptr[j], 20, 15, "cube face enables"); - BITS(ptr[j], 14, 9, "max lod"); - FLAG(ptr[j], 8, "mip layout right"); - BITS(ptr[j], 7, 0, "depth"); + PRINTF(stream, "\t TMn.2: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 21, "dword pitch"); + BITS(stream, ptr[j], 20, 15, "cube face enables"); + BITS(stream, ptr[j], 14, 9, "max lod"); + FLAG(stream, ptr[j], 8, "mip layout right"); + BITS(stream, ptr[j], 7, 0, "depth"); j++; } } @@ -550,52 +593,52 @@ static boolean debug_sampler_state( struct debug_stream *stream, unsigned len ) { unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - int j = 0; + unsigned j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); { - PRINTF("\t0x%08x\n", ptr[j]); - BITS(ptr[j], 15, 0, "sampler mask"); + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 15, 0, "sampler mask"); j++; } while (j < len) { { - PRINTF("\t TSn.0: 0x%08x\n", ptr[j]); - FLAG(ptr[j], 31, "reverse gamma"); - FLAG(ptr[j], 30, "planar to packed"); - FLAG(ptr[j], 29, "yuv->rgb"); - BITS(ptr[j], 28, 27, "chromakey index"); - BITS(ptr[j], 26, 22, "base mip level"); - BITS(ptr[j], 21, 20, "mip mode filter"); - BITS(ptr[j], 19, 17, "mag mode filter"); - BITS(ptr[j], 16, 14, "min mode filter"); - BITS(ptr[j], 13, 5, "lod bias (s4.4)"); - FLAG(ptr[j], 4, "shadow enable"); - FLAG(ptr[j], 3, "max-aniso-4"); - BITS(ptr[j], 2, 0, "shadow func"); + PRINTF(stream, "\t TSn.0: 0x%08x\n", ptr[j]); + FLAG(stream, ptr[j], 31, "reverse gamma"); + FLAG(stream, ptr[j], 30, "planar to packed"); + FLAG(stream, ptr[j], 29, "yuv->rgb"); + BITS(stream, ptr[j], 28, 27, "chromakey index"); + BITS(stream, ptr[j], 26, 22, "base mip level"); + BITS(stream, ptr[j], 21, 20, "mip mode filter"); + BITS(stream, ptr[j], 19, 17, "mag mode filter"); + BITS(stream, ptr[j], 16, 14, "min mode filter"); + BITS(stream, ptr[j], 13, 5, "lod bias (s4.4)"); + FLAG(stream, ptr[j], 4, "shadow enable"); + FLAG(stream, ptr[j], 3, "max-aniso-4"); + BITS(stream, ptr[j], 2, 0, "shadow func"); j++; } { - PRINTF("\t TSn.1: 0x%08x\n", ptr[j]); - BITS(ptr[j], 31, 24, "min lod"); + PRINTF(stream, "\t TSn.1: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 24, "min lod"); MBZ( ptr[j], 23, 18 ); - FLAG(ptr[j], 17, "kill pixel enable"); - FLAG(ptr[j], 16, "keyed tex filter mode"); - FLAG(ptr[j], 15, "chromakey enable"); - BITS(ptr[j], 14, 12, "tcx wrap mode"); - BITS(ptr[j], 11, 9, "tcy wrap mode"); - BITS(ptr[j], 8, 6, "tcz wrap mode"); - FLAG(ptr[j], 5, "normalized coords"); - BITS(ptr[j], 4, 1, "map (surface) index"); - FLAG(ptr[j], 0, "EAST deinterlacer enable"); + FLAG(stream, ptr[j], 17, "kill pixel enable"); + FLAG(stream, ptr[j], 16, "keyed tex filter mode"); + FLAG(stream, ptr[j], 15, "chromakey enable"); + BITS(stream, ptr[j], 14, 12, "tcx wrap mode"); + BITS(stream, ptr[j], 11, 9, "tcy wrap mode"); + BITS(stream, ptr[j], 8, 6, "tcz wrap mode"); + FLAG(stream, ptr[j], 5, "normalized coords"); + BITS(stream, ptr[j], 4, 1, "map (surface) index"); + FLAG(stream, ptr[j], 0, "EAST deinterlacer enable"); j++; } { - PRINTF("\t TSn.2: 0x%08x (default color)\n", ptr[j]); + PRINTF(stream, "\t TSn.2: 0x%08x (default color)\n", ptr[j]); j++; } } @@ -612,26 +655,26 @@ static boolean debug_dest_vars( struct debug_stream *stream, unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); int j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); { - PRINTF("\t0x%08x\n", ptr[j]); - FLAG(ptr[j], 31, "early classic ztest"); - FLAG(ptr[j], 30, "opengl tex default color"); - FLAG(ptr[j], 29, "bypass iz"); - FLAG(ptr[j], 28, "lod preclamp"); - BITS(ptr[j], 27, 26, "dither pattern"); - FLAG(ptr[j], 25, "linear gamma blend"); - FLAG(ptr[j], 24, "debug dither"); - BITS(ptr[j], 23, 20, "dstorg x"); - BITS(ptr[j], 19, 16, "dstorg y"); + PRINTF(stream, "\t0x%08x\n", ptr[j]); + FLAG(stream, ptr[j], 31, "early classic ztest"); + FLAG(stream, ptr[j], 30, "opengl tex default color"); + FLAG(stream, ptr[j], 29, "bypass iz"); + FLAG(stream, ptr[j], 28, "lod preclamp"); + BITS(stream, ptr[j], 27, 26, "dither pattern"); + FLAG(stream, ptr[j], 25, "linear gamma blend"); + FLAG(stream, ptr[j], 24, "debug dither"); + BITS(stream, ptr[j], 23, 20, "dstorg x"); + BITS(stream, ptr[j], 19, 16, "dstorg y"); MBZ (ptr[j], 15, 15 ); - BITS(ptr[j], 14, 12, "422 write select"); - BITS(ptr[j], 11, 8, "cbuf format"); - BITS(ptr[j], 3, 2, "zbuf format"); - FLAG(ptr[j], 1, "vert line stride"); - FLAG(ptr[j], 1, "vert line stride offset"); + BITS(stream, ptr[j], 14, 12, "422 write select"); + BITS(stream, ptr[j], 11, 8, "cbuf format"); + BITS(stream, ptr[j], 3, 2, "zbuf format"); + FLAG(stream, ptr[j], 1, "vert line stride"); + FLAG(stream, ptr[j], 1, "vert line stride offset"); j++; } @@ -647,23 +690,23 @@ static boolean debug_buf_info( struct debug_stream *stream, unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); int j = 0; - PRINTF("%s (%d dwords):\n", name, len); - PRINTF("\t0x%08x\n", ptr[j++]); + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); { - PRINTF("\t0x%08x\n", ptr[j]); - BITS(ptr[j], 28, 28, "aux buffer id"); - BITS(ptr[j], 27, 24, "buffer id (7=depth, 3=back)"); - FLAG(ptr[j], 23, "use fence regs"); - FLAG(ptr[j], 22, "tiled surface"); - FLAG(ptr[j], 21, "tile walk ymajor"); + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 28, 28, "aux buffer id"); + BITS(stream, ptr[j], 27, 24, "buffer id (7=depth, 3=back)"); + FLAG(stream, ptr[j], 23, "use fence regs"); + FLAG(stream, ptr[j], 22, "tiled surface"); + FLAG(stream, ptr[j], 21, "tile walk ymajor"); MBZ (ptr[j], 20, 14); - BITS(ptr[j], 13, 2, "dword pitch"); + BITS(stream, ptr[j], 13, 2, "dword pitch"); MBZ (ptr[j], 2, 0); j++; } - PRINTF("\t0x%08x -- buffer base address\n", ptr[j++]); + PRINTF(stream, "\t0x%08x -- buffer base address\n", ptr[j++]); stream->offset += len * sizeof(unsigned); assert(j == len); @@ -827,7 +870,7 @@ i915_dump_batchbuffer( struct i915_context *i915 ) struct debug_stream stream; unsigned *start = i915->batch_start; unsigned *end = i915->winsys->batch_start( i915->winsys, 0, 0 ); - unsigned bytes = (end - start) * 4; + unsigned long bytes = (unsigned long) (end - start) * 4; boolean done = FALSE; stream.offset = 0; @@ -843,8 +886,7 @@ i915_dump_batchbuffer( struct i915_context *i915 ) stream.winsys->printf( stream.winsys, "\n\nBATCH: (%d)\n", bytes / 4); while (!done && - stream.offset < bytes && - stream.offset >= 0) + stream.offset < bytes) { if (!i915_debug_packet( &stream )) break; diff --git a/src/mesa/pipe/i915simple/i915_debug.h b/src/mesa/pipe/i915simple/i915_debug.h index 4c3aa64b42..13197f3595 100644 --- a/src/mesa/pipe/i915simple/i915_debug.h +++ b/src/mesa/pipe/i915simple/i915_debug.h @@ -31,6 +31,8 @@ #ifndef I915_DEBUG_H #define I915_DEBUG_H +#include <stdarg.h> + struct i915_context; struct debug_stream @@ -67,15 +69,39 @@ void i915_print_ureg(const char *msg, unsigned ureg); #define DEBUG_SURFACE 0x2000 #define DEBUG_WINSYS 0x4000 -#ifdef DEBUG +#if defined(DEBUG) && defined(FILE_DEBUG_FLAG) + #include "pipe/p_winsys.h" -#define DBG( i915, ... ) do { \ - if ((i915)->debug & FILE_DEBUG_FLAG) \ - (i915)->pipe.winsys->printf( (i915)->pipe.winsys, __VA_ARGS__ ); \ -} while(0) + +static void +I915_DBG( + struct i915_context *i915, + const char *fmt, + ... ) +{ + if ((i915)->debug & FILE_DEBUG_FLAG) { + va_list args; + char buffer[256]; + + va_start( args, fmt ); + vsprintf( buffer, fmt, args ); + i915->pipe.winsys->printf( i915->pipe.winsys, buffer ); + va_end( args ); + } +} + #else -#define DBG( i915, ... ) \ - (void)i915 + +static void +I915_DBG( + struct i915_context *i915, + const char *fmt, + ... ) +{ + (void) i915; + (void) fmt; +} + #endif diff --git a/src/mesa/pipe/i915simple/i915_debug_fp.c b/src/mesa/pipe/i915simple/i915_debug_fp.c index 87fc3b2f9a..ebfdb3d93c 100644 --- a/src/mesa/pipe/i915simple/i915_debug_fp.c +++ b/src/mesa/pipe/i915simple/i915_debug_fp.c @@ -32,11 +32,20 @@ #include "pipe/p_util.h" +static void +PRINTF( + struct debug_stream *stream, + const char *fmt, + ... ) +{ + va_list args; + char buffer[256]; - -#define PRINTF( ... ) (stream)->winsys->printf( (stream)->winsys, __VA_ARGS__ ) - - + va_start( args, fmt ); + vsprintf( buffer, fmt, args ); + stream->winsys->printf( stream->winsys, buffer ); + va_end( args ); +} static const char *opcodes[0x20] = { @@ -129,27 +138,27 @@ print_reg_type_nr(struct debug_stream *stream, unsigned type, unsigned nr) case REG_TYPE_T: switch (nr) { case T_DIFFUSE: - PRINTF("T_DIFFUSE"); + PRINTF(stream, "T_DIFFUSE"); return; case T_SPECULAR: - PRINTF("T_SPECULAR"); + PRINTF(stream, "T_SPECULAR"); return; case T_FOG_W: - PRINTF("T_FOG_W"); + PRINTF(stream, "T_FOG_W"); return; default: - PRINTF("T_TEX%d", nr); + PRINTF(stream, "T_TEX%d", nr); return; } case REG_TYPE_OC: if (nr == 0) { - PRINTF("oC"); + PRINTF(stream, "oC"); return; } break; case REG_TYPE_OD: if (nr == 0) { - PRINTF("oD"); + PRINTF(stream, "oD"); return; } break; @@ -157,7 +166,7 @@ print_reg_type_nr(struct debug_stream *stream, unsigned type, unsigned nr) break; } - PRINTF("%s[%d]", regname[type], nr); + PRINTF(stream, "%s[%d]", regname[type], nr); } #define REG_SWIZZLE_MASK 0x7777 @@ -178,33 +187,33 @@ print_reg_neg_swizzle(struct debug_stream *stream, unsigned reg) (reg & REG_NEGATE_MASK) == 0) return; - PRINTF("."); + PRINTF(stream, "."); for (i = 3; i >= 0; i--) { if (reg & (1 << ((i * 4) + 3))) - PRINTF("-"); + PRINTF(stream, "-"); switch ((reg >> (i * 4)) & 0x7) { case 0: - PRINTF("x"); + PRINTF(stream, "x"); break; case 1: - PRINTF("y"); + PRINTF(stream, "y"); break; case 2: - PRINTF("z"); + PRINTF(stream, "z"); break; case 3: - PRINTF("w"); + PRINTF(stream, "w"); break; case 4: - PRINTF("0"); + PRINTF(stream, "0"); break; case 5: - PRINTF("1"); + PRINTF(stream, "1"); break; default: - PRINTF("?"); + PRINTF(stream, "?"); break; } } @@ -229,15 +238,15 @@ print_dest_reg(struct debug_stream *stream, unsigned dword) print_reg_type_nr(stream, type, nr); if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL) return; - PRINTF("."); + PRINTF(stream, "."); if (dword & A0_DEST_CHANNEL_X) - PRINTF("x"); + PRINTF(stream, "x"); if (dword & A0_DEST_CHANNEL_Y) - PRINTF("y"); + PRINTF(stream, "y"); if (dword & A0_DEST_CHANNEL_Z) - PRINTF("z"); + PRINTF(stream, "z"); if (dword & A0_DEST_CHANNEL_W) - PRINTF("w"); + PRINTF(stream, "w"); } @@ -253,29 +262,29 @@ print_arith_op(struct debug_stream *stream, if (opcode != A0_NOP) { print_dest_reg(stream, program[0]); if (program[0] & A0_DEST_SATURATE) - PRINTF(" = SATURATE "); + PRINTF(stream, " = SATURATE "); else - PRINTF(" = "); + PRINTF(stream, " = "); } - PRINTF("%s ", opcodes[opcode]); + PRINTF(stream, "%s ", opcodes[opcode]); print_src_reg(stream, GET_SRC0_REG(program[0], program[1])); if (args[opcode] == 1) { - PRINTF("\n"); + PRINTF(stream, "\n"); return; } - PRINTF(", "); + PRINTF(stream, ", "); print_src_reg(stream, GET_SRC1_REG(program[1], program[2])); if (args[opcode] == 2) { - PRINTF("\n"); + PRINTF(stream, "\n"); return; } - PRINTF(", "); + PRINTF(stream, ", "); print_src_reg(stream, GET_SRC2_REG(program[2])); - PRINTF("\n"); + PRINTF(stream, "\n"); return; } @@ -285,40 +294,40 @@ print_tex_op(struct debug_stream *stream, unsigned opcode, const unsigned * program) { print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL); - PRINTF(" = "); + PRINTF(stream, " = "); - PRINTF("%s ", opcodes[opcode]); + PRINTF(stream, "%s ", opcodes[opcode]); - PRINTF("S[%d],", program[0] & T0_SAMPLER_NR_MASK); + PRINTF(stream, "S[%d],", program[0] & T0_SAMPLER_NR_MASK); print_reg_type_nr(stream, (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) & REG_TYPE_MASK, (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK); - PRINTF("\n"); + PRINTF(stream, "\n"); } static void print_texkil_op(struct debug_stream *stream, unsigned opcode, const unsigned * program) { - PRINTF("TEXKIL "); + PRINTF(stream, "TEXKIL "); print_reg_type_nr(stream, (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) & REG_TYPE_MASK, (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK); - PRINTF("\n"); + PRINTF(stream, "\n"); } static void print_dcl_op(struct debug_stream *stream, unsigned opcode, const unsigned * program) { - PRINTF("%s ", opcodes[opcode]); + PRINTF(stream, "%s ", opcodes[opcode]); print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL); - PRINTF("\n"); + PRINTF(stream, "\n"); } @@ -327,9 +336,9 @@ i915_disassemble_program(struct debug_stream *stream, const unsigned * program, unsigned sz) { unsigned size = program[0] & 0x1ff; - int i; + unsigned i; - PRINTF("\t\tBEGIN\n"); + PRINTF(stream, "\t\tBEGIN\n"); assert(size + 2 == sz); @@ -337,7 +346,7 @@ i915_disassemble_program(struct debug_stream *stream, for (i = 1; i < sz; i += 3, program += 3) { unsigned opcode = program[0] & (0x1f << 24); - PRINTF("\t\t"); + PRINTF(stream, "\t\t"); if ((int) opcode >= A0_NOP && opcode <= A0_SLT) print_arith_op(stream, opcode >> 24, program); @@ -348,10 +357,10 @@ i915_disassemble_program(struct debug_stream *stream, else if (opcode == D0_DCL) print_dcl_op(stream, opcode >> 24, program); else - PRINTF("Unknown opcode 0x%x\n", opcode); + PRINTF(stream, "Unknown opcode 0x%x\n", opcode); } - PRINTF("\t\tEND\n\n"); + PRINTF(stream, "\t\tEND\n\n"); } diff --git a/src/mesa/pipe/i915simple/i915_flush.c b/src/mesa/pipe/i915simple/i915_flush.c index 1044cb1bdb..3c2069b827 100644 --- a/src/mesa/pipe/i915simple/i915_flush.c +++ b/src/mesa/pipe/i915simple/i915_flush.c @@ -69,8 +69,7 @@ static void i915_flush( struct pipe_context *pipe, FLUSH_BATCH(); if (flags & PIPE_FLUSH_WAIT) { - if( i915->last_fence ) - i915->winsys->fence_wait(i915->winsys, i915->last_fence); + i915->winsys->batch_finish(i915->winsys); } } diff --git a/src/mesa/pipe/i915simple/i915_fpc_emit.c b/src/mesa/pipe/i915simple/i915_fpc_emit.c index c8d36435d9..74924ff0a1 100644 --- a/src/mesa/pipe/i915simple/i915_fpc_emit.c +++ b/src/mesa/pipe/i915simple/i915_fpc_emit.c @@ -235,7 +235,7 @@ uint i915_emit_texld( struct i915_fp_compile *p, uint i915_emit_const1f(struct i915_fp_compile * p, float c0) { - int reg, idx; + unsigned reg, idx; if (c0 == 0.0) return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO); @@ -264,7 +264,7 @@ i915_emit_const1f(struct i915_fp_compile * p, float c0) uint i915_emit_const2f(struct i915_fp_compile * p, float c0, float c1) { - int reg, idx; + unsigned reg, idx; if (c0 == 0.0) return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W); @@ -302,7 +302,7 @@ uint i915_emit_const4f(struct i915_fp_compile * p, float c0, float c1, float c2, float c3) { - int reg; + unsigned reg; for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { if (p->constant_flags[reg] == 0xf && diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c index d74da85216..1cd554250c 100644 --- a/src/mesa/pipe/i915simple/i915_fpc_translate.c +++ b/src/mesa/pipe/i915simple/i915_fpc_translate.c @@ -32,8 +32,8 @@ #include "i915_context.h" #include "i915_fpc.h" -#include "pipe/tgsi/exec/tgsi_token.h" -#include "pipe/tgsi/exec/tgsi_parse.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/tgsi/util/tgsi_parse.h" #include "pipe/draw/draw_vertex.h" @@ -69,16 +69,16 @@ static unsigned passthrough[] = /* 1, -1/3!, 1/5!, -1/7! */ static const float sin_constants[4] = { 1.0, - -1.0 / (3 * 2 * 1), - 1.0 / (5 * 4 * 3 * 2 * 1), - -1.0 / (7 * 6 * 5 * 4 * 3 * 2 * 1) + -1.0f / (3 * 2 * 1), + 1.0f / (5 * 4 * 3 * 2 * 1), + -1.0f / (7 * 6 * 5 * 4 * 3 * 2 * 1) }; /* 1, -1/2!, 1/4!, -1/6! */ static const float cos_constants[4] = { 1.0, - -1.0 / (2 * 1), - 1.0 / (4 * 3 * 2 * 1), - -1.0 / (6 * 5 * 4 * 3 * 2 * 1) + -1.0f / (2 * 1), + 1.0f / (4 * 3 * 2 * 1), + -1.0f / (6 * 5 * 4 * 3 * 2 * 1) }; @@ -102,7 +102,7 @@ i915_use_passthrough_shader(struct i915_context *i915) { fprintf(stderr, "**** Using i915 pass-through fragment shader\n"); - i915->current.program = (uint *) malloc(sizeof(passthrough)); + i915->current.program = (uint *) MALLOC(sizeof(passthrough)); if (i915->current.program) { memcpy(i915->current.program, passthrough, sizeof(passthrough)); i915->current.program_len = Elements(passthrough); @@ -117,11 +117,13 @@ void i915_program_error(struct i915_fp_compile *p, const char *msg, ...) { va_list args; + char buffer[1024]; fprintf(stderr, "i915_program_error: "); va_start( args, msg ); - vfprintf( stderr, msg, args ); + vsprintf( buffer, msg, args ); va_end( args ); + fprintf(stderr, buffer); fprintf(stderr, "\n"); p->error = 1; @@ -167,7 +169,7 @@ src_vector(struct i915_fp_compile *p, switch (sem_name) { case TGSI_SEMANTIC_POSITION: - printf("SKIP SEM POS\n"); + fprintf(stderr, "SKIP SEM POS\n"); /* assert(p->wpos_tex != -1); src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL); @@ -381,6 +383,9 @@ emit_simple_arith(struct i915_fp_compile *p, arg3 ); } +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif /* * Translate TGSI instruction to i915 instruction. @@ -430,7 +435,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_X, 0, - src0, i915_emit_const1f(p, 1.0 / (M_PI * 2)), 0); + src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0); i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0); @@ -439,7 +444,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_X, 0, - tmp, i915_emit_const1f(p, (M_PI * 2)), 0); + tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0); /* * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 @@ -772,7 +777,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_X, 0, - src0, i915_emit_const1f(p, 1.0 / (M_PI * 2)), 0); + src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0); i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0); @@ -781,7 +786,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_X, 0, - tmp, i915_emit_const1f(p, (M_PI * 2)), 0); + tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0); /* * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 @@ -986,8 +991,8 @@ i915_init_compile(struct i915_context *i915, static void i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) { - uint program_size = p->csr - p->program; - uint decl_size = p->decl - p->declarations; + unsigned long program_size = (unsigned long) (p->csr - p->program); + unsigned long decl_size = (unsigned long) (p->decl - p->declarations); if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT) i915_program_error(p, "Exceeded max nr indirect texture lookups"); @@ -1003,7 +1008,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) /* free old program, if present */ if (i915->current.program) { - free(i915->current.program); + FREE(i915->current.program); i915->current.program_len = 0; } @@ -1028,7 +1033,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) /* Copy compilation results to fragment program struct: */ i915->current.program - = (uint *) malloc((program_size + decl_size) * sizeof(uint)); + = (uint *) MALLOC((program_size + decl_size) * sizeof(uint)); if (i915->current.program) { i915->current.program_len = program_size + decl_size; @@ -1049,7 +1054,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) /* Release the compilation struct: */ - free(p); + FREE(p); } diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/mesa/pipe/i915simple/i915_prim_vbuf.c index 35174c64a0..08ac5b672c 100644 --- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c +++ b/src/mesa/pipe/i915simple/i915_prim_vbuf.c @@ -38,16 +38,12 @@ */ -#include "pipe/draw/draw_private.h" -#include "pipe/draw/draw_vertex.h" +#include <assert.h> + +#include "pipe/draw/draw_vbuf.h" #include "pipe/p_util.h" #include "pipe/p_winsys.h" -#include "softpipe/sp_context.h" -#include "softpipe/sp_headers.h" -#include "softpipe/sp_quad.h" -#include "softpipe/sp_prim_setup.h" - #include "i915_context.h" #include "i915_reg.h" #include "i915_winsys.h" @@ -55,253 +51,99 @@ #include "i915_state.h" -static void vbuf_flush_elements( struct draw_stage *stage ); -static void vbuf_flush_vertices( struct draw_stage *stage ); - - -#define VBUF_SIZE (128*1024) -#define IBUF_SIZE (16*1024) - - /** - * Vertex buffer emit stage. + * Primitive renderer for i915. */ -struct vbuf_stage { - struct draw_stage stage; /**< This must be first (base class) */ +struct i915_vbuf_render { + struct vbuf_render base; + + struct i915_context *i915; /** Vertex size in bytes */ unsigned vertex_size; - /* FIXME: we have no guarantee that 'unsigned' is 32bit */ - - /** Vertices in hardware format */ - unsigned *vertex_map; - unsigned *vertex_ptr; - unsigned max_vertices; - unsigned nr_vertices; - - ushort *element_map; - unsigned nr_elements; - - unsigned prim; - - struct i915_context *i915; + /** Hardware primitive */ + unsigned hwprim; }; /** * Basically a cast wrapper. */ -static INLINE struct vbuf_stage *vbuf_stage( struct draw_stage *stage ) -{ - return (struct vbuf_stage *)stage; -} - - -static INLINE boolean -overflow( void *map, void *ptr, unsigned bytes, unsigned bufsz ) -{ - unsigned long used = (char *)ptr - (char *)map; - return (used + bytes) > bufsz; -} - - -static INLINE void -check_space( struct vbuf_stage *vbuf, unsigned nr ) -{ - if (overflow( vbuf->vertex_map, - vbuf->vertex_ptr, - nr*vbuf->vertex_size, - VBUF_SIZE )) - vbuf_flush_vertices(&vbuf->stage); - - if (vbuf->nr_elements + nr > IBUF_SIZE / sizeof(ushort) ) - vbuf_flush_elements(&vbuf->stage); -} - - -/** - * Extract the needed fields from vertex_header and emit i915 dwords. - * Recall that the vertices are constructed by the 'draw' module and - * have a couple of slots at the beginning (1-dword header, 4-dword - * clip pos) that we ignore here. - */ -static INLINE void -emit_vertex( struct vbuf_stage *vbuf, - struct vertex_header *vertex ) +static INLINE struct i915_vbuf_render * +i915_vbuf_render( struct vbuf_render *render ) { - struct i915_context *i915 = vbuf->i915; - const struct vertex_info *vinfo = &i915->current.vertex_info; - uint i; - uint count = 0; /* for debug/sanity */ - -// fprintf(stderr, "emit vertex %d to %p\n", -// vbuf->nr_vertices, vbuf->vertex_ptr); - - if(vertex->vertex_id != UNDEFINED_VERTEX_ID) { - if(vertex->vertex_id < vbuf->nr_vertices) - return; - else - fprintf(stderr, "Bad vertex id 0x%04x (>= 0x%04x)\n", - vertex->vertex_id, vbuf->nr_vertices); - return; - } - - vertex->vertex_id = vbuf->nr_vertices++; - - for (i = 0; i < vinfo->num_attribs; i++) { - switch (vinfo->format[i]) { - case FORMAT_OMIT: - /* no-op */ - break; - case FORMAT_1F: - *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); - count++; - break; - case FORMAT_2F: - *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); - *vbuf->vertex_ptr++ = fui(vertex->data[i][1]); - count += 2; - break; - case FORMAT_3F: - *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); - *vbuf->vertex_ptr++ = fui(vertex->data[i][1]); - *vbuf->vertex_ptr++ = fui(vertex->data[i][2]); - count += 3; - break; - case FORMAT_4F: - *vbuf->vertex_ptr++ = fui(vertex->data[i][0]); - *vbuf->vertex_ptr++ = fui(vertex->data[i][1]); - *vbuf->vertex_ptr++ = fui(vertex->data[i][2]); - *vbuf->vertex_ptr++ = fui(vertex->data[i][3]); - count += 4; - break; - case FORMAT_4UB: - *vbuf->vertex_ptr++ = pack_ub4(float_to_ubyte( vertex->data[i][2] ), - float_to_ubyte( vertex->data[i][1] ), - float_to_ubyte( vertex->data[i][0] ), - float_to_ubyte( vertex->data[i][3] )); - count += 1; - break; - default: - assert(0); - } - } - assert(count == vinfo->size); + assert(render); + return (struct i915_vbuf_render *)render; } -static void vbuf_tri( struct draw_stage *stage, - struct prim_header *prim ) +static const struct vertex_info * +i915_vbuf_render_get_vertex_info( struct vbuf_render *render ) { - struct vbuf_stage *vbuf = vbuf_stage( stage ); - unsigned i; - - check_space( vbuf, 3 ); - - for (i = 0; i < 3; i++) { - emit_vertex( vbuf, prim->v[i] ); - - vbuf->element_map[vbuf->nr_elements++] = prim->v[i]->vertex_id; - } + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + return &i915->current.vertex_info; } -static void vbuf_line(struct draw_stage *stage, - struct prim_header *prim) +static void * +i915_vbuf_render_allocate_vertices( struct vbuf_render *render, + ushort vertex_size, + ushort nr_vertices ) { - struct vbuf_stage *vbuf = vbuf_stage( stage ); - unsigned i; - - check_space( vbuf, 2 ); - - for (i = 0; i < 2; i++) { - emit_vertex( vbuf, prim->v[i] ); - - vbuf->element_map[vbuf->nr_elements++] = prim->v[i]->vertex_id; - } -} - - -static void vbuf_point(struct draw_stage *stage, - struct prim_header *prim) -{ - struct vbuf_stage *vbuf = vbuf_stage( stage ); - - check_space( vbuf, 1 ); + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + struct pipe_winsys *winsys = i915->pipe.winsys; + size_t size = (size_t)vertex_size * (size_t)nr_vertices; - emit_vertex( vbuf, prim->v[0] ); + /* FIXME: handle failure */ + assert(!i915->vbo); + i915->vbo = winsys->buffer_create(winsys, 64); + winsys->buffer_data( winsys, i915->vbo, + size, NULL, + I915_BUFFER_USAGE_LIT_VERTEX ); - vbuf->element_map[vbuf->nr_elements++] = prim->v[0]->vertex_id; -} - - -static void vbuf_first_tri( struct draw_stage *stage, - struct prim_header *prim ) -{ - struct vbuf_stage *vbuf = vbuf_stage( stage ); - - vbuf_flush_elements( stage ); - stage->tri = vbuf_tri; - stage->tri( stage, prim ); - vbuf->prim = PIPE_PRIM_TRIANGLES; -} - - -static void vbuf_first_line( struct draw_stage *stage, - struct prim_header *prim ) -{ - struct vbuf_stage *vbuf = vbuf_stage( stage ); - - vbuf_flush_elements( stage ); - stage->line = vbuf_line; - stage->line( stage, prim ); - vbuf->prim = PIPE_PRIM_LINES; -} - - -static void vbuf_first_point( struct draw_stage *stage, - struct prim_header *prim ) -{ - struct vbuf_stage *vbuf = vbuf_stage( stage ); - - vbuf_flush_elements( stage ); - stage->point = vbuf_point; - stage->point( stage, prim ); - vbuf->prim = PIPE_PRIM_POINTS; + i915->dirty |= I915_NEW_VBO; + + return winsys->buffer_map(winsys, + i915->vbo, + PIPE_BUFFER_FLAG_WRITE ); } -static void vbuf_flush_elements( struct draw_stage *stage ) +static void +i915_vbuf_render_set_primitive( struct vbuf_render *render, + unsigned prim ) { - struct vbuf_stage *vbuf = vbuf_stage( stage ); - struct i915_context *i915 = vbuf->i915; - unsigned nr = vbuf->nr_elements; - unsigned vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ - unsigned hwprim; - unsigned i; + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - if(!nr) - return; - - switch(vbuf->prim) { + switch(prim) { case PIPE_PRIM_POINTS: - hwprim = PRIM3D_POINTLIST; + i915_render->hwprim = PRIM3D_POINTLIST; break; case PIPE_PRIM_LINES: - hwprim = PRIM3D_LINELIST; - assert(nr % 2 == 0); + i915_render->hwprim = PRIM3D_LINELIST; break; case PIPE_PRIM_TRIANGLES: - hwprim = PRIM3D_TRILIST; - assert(nr % 3 == 0); + i915_render->hwprim = PRIM3D_TRILIST; break; default: assert(0); - return; } - - assert(vbuf->vertex_ptr - vbuf->vertex_map == vbuf->nr_vertices * vertex_size / 4); +} + + +static void +i915_vbuf_render_draw( struct vbuf_render *render, + const ushort *indices, + unsigned nr_indices ) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + unsigned i; + + assert(nr_indices); assert((i915->dirty & ~I915_NEW_VBO) == 0); @@ -311,7 +153,7 @@ static void vbuf_flush_elements( struct draw_stage *stage ) if (i915->hardware_dirty) i915_emit_hardware_state( i915 ); - if (!BEGIN_BATCH( 1 + (nr + 1)/2, 1 )) { + if (!BEGIN_BATCH( 1 + (nr_indices + 1)/2, 1 )) { FLUSH_BATCH(); /* Make sure state is re-emitted after a flush: @@ -319,7 +161,7 @@ static void vbuf_flush_elements( struct draw_stage *stage ) i915_update_derived( i915 ); i915_emit_hardware_state( i915 ); - if (!BEGIN_BATCH( 1 + (nr + 1)/2, 1 )) { + if (!BEGIN_BATCH( 1 + (nr_indices + 1)/2, 1 )) { assert(0); return; } @@ -327,95 +169,68 @@ static void vbuf_flush_elements( struct draw_stage *stage ) OUT_BATCH( _3DPRIMITIVE | PRIM_INDIRECT | - hwprim | + i915_render->hwprim | PRIM_INDIRECT_ELTS | - nr ); - for (i = 0; i + 1 < nr; i += 2) { - OUT_BATCH( vbuf->element_map[i] | - (vbuf->element_map[i + 1] << 16) ); + nr_indices ); + for (i = 0; i + 1 < nr_indices; i += 2) { + OUT_BATCH( indices[i] | + (indices[i + 1] << 16) ); } - if (i < nr) { - OUT_BATCH( vbuf->element_map[i] ); + if (i < nr_indices) { + OUT_BATCH( indices[i] ); } - - vbuf->nr_elements = 0; } - -/** - * Flush vertex buffer. - */ -static void vbuf_flush_vertices( struct draw_stage *stage ) +static void +i915_vbuf_render_release_vertices( struct vbuf_render *render, + void *vertices, + unsigned vertex_size, + unsigned vertices_used ) { - struct vbuf_stage *vbuf = vbuf_stage( stage ); - struct i915_context *i915 = vbuf->i915; + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; struct pipe_winsys *winsys = i915->pipe.winsys; - if(vbuf->nr_vertices) { - - vbuf_flush_elements(stage); - - winsys->buffer_unmap(winsys, i915->vbo); - - vbuf->nr_vertices = 0; - - /** - * XXX: Reset vertex ids? Actually, want to not do that unless our - * vertex buffer is full. Would like separate - * flush-on-index-full and flush-on-vb-full, but may raise - * issues uploading vertices if the hardware wants to flush when - * we flush. - */ - draw_reset_vertex_ids( vbuf->i915->draw ); - } - - /* FIXME: handle failure */ - if(!i915->vbo) - i915->vbo = winsys->buffer_create(winsys, 64); - winsys->buffer_data( winsys, i915->vbo, - VBUF_SIZE, NULL, - I915_BUFFER_USAGE_LIT_VERTEX ); - - i915->dirty |= I915_NEW_VBO; - - vbuf->vertex_map = winsys->buffer_map(winsys, - i915->vbo, - PIPE_BUFFER_FLAG_WRITE ); - vbuf->vertex_ptr = vbuf->vertex_map; + assert(i915->vbo); + winsys->buffer_unmap(winsys, i915->vbo); + winsys->buffer_reference(winsys, &i915->vbo, NULL); } - -static void vbuf_begin( struct draw_stage *stage ) +static void +i915_vbuf_render_destroy( struct vbuf_render *render ) { - struct vbuf_stage *vbuf = vbuf_stage(stage); - struct i915_context *i915 = vbuf->i915; - unsigned vertex_size = i915->current.vertex_info.size * 4; - - assert(!i915->dirty); - - if(vbuf->vertex_size != vertex_size) - vbuf_flush_vertices(stage); - - vbuf->vertex_size = vertex_size; + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + free(i915_render); } -static void vbuf_end( struct draw_stage *stage ) +/** + * Create a new primitive render. + */ +static struct vbuf_render * +i915_vbuf_render_create( struct i915_context *i915 ) { - /* Overkill. + struct i915_vbuf_render *i915_render = CALLOC_STRUCT(i915_vbuf_render); + + i915_render->i915 = i915; + + i915_render->base.max_vertex_buffer_bytes = 128*1024; + + /* NOTE: it must be such that state and vertices indices fit in a single + * batch buffer. */ - vbuf_flush_elements( stage ); + i915_render->base.max_indices = 16*1024; - stage->point = vbuf_first_point; - stage->line = vbuf_first_line; - stage->tri = vbuf_first_tri; -} - - -static void reset_stipple_counter( struct draw_stage *stage ) -{ + i915_render->base.get_vertex_info = i915_vbuf_render_get_vertex_info; + i915_render->base.allocate_vertices = i915_vbuf_render_allocate_vertices; + i915_render->base.set_primitive = i915_vbuf_render_set_primitive; + i915_render->base.draw = i915_vbuf_render_draw; + i915_render->base.release_vertices = i915_vbuf_render_release_vertices; + i915_render->base.destroy = i915_vbuf_render_destroy; + + return &i915_render->base; } @@ -424,24 +239,18 @@ static void reset_stipple_counter( struct draw_stage *stage ) */ struct draw_stage *i915_draw_vbuf_stage( struct i915_context *i915 ) { - struct vbuf_stage *vbuf = CALLOC_STRUCT(vbuf_stage); - - vbuf->i915 = i915; - vbuf->stage.draw = i915->draw; - vbuf->stage.begin = vbuf_begin; - vbuf->stage.point = vbuf_first_point; - vbuf->stage.line = vbuf_first_line; - vbuf->stage.tri = vbuf_first_tri; - vbuf->stage.end = vbuf_end; - vbuf->stage.reset_stipple_counter = reset_stipple_counter; - - assert(IBUF_SIZE < UNDEFINED_VERTEX_ID); - - /* FIXME: free this memory on takedown */ - vbuf->element_map = malloc( IBUF_SIZE ); - vbuf->vertex_map = NULL; + struct vbuf_render *render; + struct draw_stage *stage; - vbuf->vertex_ptr = vbuf->vertex_map; + render = i915_vbuf_render_create(i915); + if(!render) + return NULL; - return &vbuf->stage; + stage = draw_vbuf_stage( i915->draw, render ); + if(!stage) { + render->destroy(render); + return NULL; + } + + return stage; } diff --git a/src/mesa/pipe/i915simple/i915_regions.c b/src/mesa/pipe/i915simple/i915_regions.c index 0410446326..e8c4c92bc8 100644 --- a/src/mesa/pipe/i915simple/i915_regions.c +++ b/src/mesa/pipe/i915simple/i915_regions.c @@ -163,9 +163,9 @@ i915_region_copy(struct pipe_context *pipe, else { i915_copy_blit( i915_context(pipe), dst->cpp, - src->pitch, src->buffer, src_offset, - dst->pitch, dst->buffer, dst_offset, - srcx, srcy, dstx, dsty, width, height ); + (short) src->pitch, src->buffer, src_offset, + (short) dst->pitch, dst->buffer, dst_offset, + (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height ); } } @@ -204,7 +204,7 @@ i915_region_fill(struct pipe_context *pipe, ushort *row = (ushort *) get_pointer(dst, dstx, dsty); for (i = 0; i < height; i++) { for (j = 0; j < width; j++) - row[j] = value; + row[j] = (ushort) value; row += dst->pitch; } } @@ -226,10 +226,10 @@ i915_region_fill(struct pipe_context *pipe, else { i915_fill_blit( i915_context(pipe), dst->cpp, - dst->pitch, + (short) dst->pitch, dst->buffer, dst_offset, - dstx, dsty, - width, height, + (short) dstx, (short) dsty, + (short) width, (short) height, value ); } } diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c index 70b8195bf1..468d0ce91b 100644 --- a/src/mesa/pipe/i915simple/i915_state.c +++ b/src/mesa/pipe/i915simple/i915_state.c @@ -97,7 +97,7 @@ static void * i915_create_blend_state(struct pipe_context *pipe, const struct pipe_blend_state *blend) { - struct i915_blend_state *cso_data = calloc(1, sizeof(struct i915_blend_state)); + struct i915_blend_state *cso_data = CALLOC_STRUCT( i915_blend_state ); { unsigned eqRGB = blend->rgb_func; @@ -182,7 +182,7 @@ static void i915_bind_blend_state(struct pipe_context *pipe, static void i915_delete_blend_state(struct pipe_context *pipe, void *blend) { - free(blend); + FREE(blend); } static void i915_set_blend_color( struct pipe_context *pipe, @@ -199,15 +199,15 @@ static void * i915_create_sampler_state(struct pipe_context *pipe, const struct pipe_sampler_state *sampler) { - struct i915_sampler_state *cso = calloc(1, sizeof(struct i915_sampler_state)); - cso->templ = sampler; - + struct i915_sampler_state *cso = CALLOC_STRUCT( i915_sampler_state ); const unsigned ws = sampler->wrap_s; const unsigned wt = sampler->wrap_t; const unsigned wr = sampler->wrap_r; unsigned minFilt, magFilt; unsigned mipFilt; + cso->templ = sampler; + mipFilt = translate_mip_filter(sampler->min_mip_filter); if (sampler->max_anisotropy > 1.0) { minFilt = FILTER_ANISOTROPIC; @@ -222,7 +222,7 @@ i915_create_sampler_state(struct pipe_context *pipe, } { - int b = sampler->lod_bias * 16.0; + int b = (int) (sampler->lod_bias * 16.0); b = CLAMP(b, -256, 255); cso->state[0] |= ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK); } @@ -274,7 +274,7 @@ static void i915_bind_sampler_state(struct pipe_context *pipe, static void i915_delete_sampler_state(struct pipe_context *pipe, void *sampler) { - free(sampler); + FREE(sampler); } @@ -286,7 +286,7 @@ static void * i915_create_depth_stencil_state(struct pipe_context *pipe, const struct pipe_depth_stencil_state *depth_stencil) { - struct i915_depth_stencil_state *cso = calloc(1, sizeof(struct i915_depth_stencil_state)); + struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state ); { int testmask = depth_stencil->stencil.value_mask[0] & 0xff; @@ -379,7 +379,7 @@ static void i915_bind_depth_stencil_state(struct pipe_context *pipe, static void i915_delete_depth_stencil_state(struct pipe_context *pipe, void *depth_stencil) { - free(depth_stencil); + FREE(depth_stencil); } @@ -387,7 +387,7 @@ static void * i915_create_alpha_test_state(struct pipe_context *pipe, const struct pipe_alpha_test_state *alpha_test) { - struct i915_alpha_test_state *cso = calloc(1, sizeof(struct i915_alpha_test_state)); + struct i915_alpha_test_state *cso = CALLOC_STRUCT( i915_alpha_test_state ); if (alpha_test->enabled) { int test = i915_translate_compare_func(alpha_test->func); @@ -413,7 +413,7 @@ static void i915_bind_alpha_test_state(struct pipe_context *pipe, static void i915_delete_alpha_test_state(struct pipe_context *pipe, void *alpha) { - free(alpha); + FREE(alpha); } static void i915_set_scissor_state( struct pipe_context *pipe, @@ -619,7 +619,7 @@ static void * i915_create_rasterizer_state(struct pipe_context *pipe, const struct pipe_rasterizer_state *rasterizer) { - struct i915_rasterizer_state *cso = calloc(1, sizeof(struct i915_rasterizer_state)); + struct i915_rasterizer_state *cso = CALLOC_STRUCT( i915_rasterizer_state ); cso->templ = rasterizer; cso->color_interp = rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; @@ -671,7 +671,7 @@ i915_create_rasterizer_state(struct pipe_context *pipe, S4_FLATSHADE_SPECULAR); } - cso->LIS7 = rasterizer->offset_units; /* probably incorrect */ + cso->LIS7 = fui( rasterizer->offset_units ); return cso; @@ -693,7 +693,7 @@ static void i915_bind_rasterizer_state( struct pipe_context *pipe, static void i915_delete_rasterizer_state(struct pipe_context *pipe, void *setup) { - free(setup); + FREE(setup); } static void i915_set_vertex_buffer( struct pipe_context *pipe, diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c index ed1521fcce..be73769cf2 100644 --- a/src/mesa/pipe/i915simple/i915_state_derived.c +++ b/src/mesa/pipe/i915simple/i915_state_derived.c @@ -33,7 +33,7 @@ #include "i915_state.h" #include "i915_reg.h" #include "i915_fpc.h" -#include "pipe/tgsi/exec/tgsi_token.h" +#include "pipe/p_shader_tokens.h" /** @@ -132,11 +132,8 @@ static void calculate_vertex_layout( struct i915_context *i915 ) /* If the attributes have changed, tell the draw module about the new * vertex layout. We'll also update the hardware vertex format info. */ - draw_set_vertex_attributes( i915->draw, - NULL,/*vinfo.slot_to_attrib,*/ - vinfo.interp_mode, - vinfo.num_attribs); - + draw_set_vertex_info( i915->draw, &vinfo); + draw_set_twoside_attributes(i915->draw, front0, back0, front1, back1); diff --git a/src/mesa/pipe/i915simple/i915_state_dynamic.c b/src/mesa/pipe/i915simple/i915_state_dynamic.c index 845873baa0..8cfbdddd19 100644 --- a/src/mesa/pipe/i915simple/i915_state_dynamic.c +++ b/src/mesa/pipe/i915simple/i915_state_dynamic.c @@ -45,12 +45,12 @@ * (active) state every time a 4kb boundary is crossed. */ -static inline void set_dynamic_indirect( struct i915_context *i915, +static INLINE void set_dynamic_indirect( struct i915_context *i915, unsigned offset, const unsigned *src, unsigned dwords ) { - int i; + unsigned i; for (i = 0; i < dwords; i++) i915->current.dynamic[offset + i] = src[i]; @@ -80,8 +80,8 @@ static void upload_MODES4( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_MODES4 = { - .dirty = I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, - .update = upload_MODES4 + I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, + upload_MODES4 }; @@ -99,8 +99,8 @@ static void upload_BFO( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_BFO = { - .dirty = I915_NEW_DEPTH_STENCIL, - .update = upload_BFO + I915_NEW_DEPTH_STENCIL, + upload_BFO }; @@ -133,8 +133,8 @@ static void upload_BLENDCOLOR( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_BLENDCOLOR = { - .dirty = I915_NEW_BLEND, - .update = upload_BLENDCOLOR + I915_NEW_BLEND, + upload_BLENDCOLOR }; /*********************************************************************** @@ -153,8 +153,8 @@ static void upload_IAB( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_IAB = { - .dirty = I915_NEW_BLEND, - .update = upload_IAB + I915_NEW_BLEND, + upload_IAB }; @@ -172,8 +172,8 @@ static void upload_DEPTHSCALE( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_DEPTHSCALE = { - .dirty = I915_NEW_RASTERIZER, - .update = upload_DEPTHSCALE + I915_NEW_RASTERIZER, + upload_DEPTHSCALE }; @@ -230,8 +230,8 @@ static void upload_STIPPLE( struct i915_context *i915 ) const struct i915_tracked_state i915_upload_STIPPLE = { - .dirty = I915_NEW_RASTERIZER | I915_NEW_STIPPLE, - .update = upload_STIPPLE + I915_NEW_RASTERIZER | I915_NEW_STIPPLE, + upload_STIPPLE }; @@ -248,8 +248,8 @@ static void upload_SCISSOR_ENABLE( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = { - .dirty = I915_NEW_RASTERIZER, - .update = upload_SCISSOR_ENABLE + I915_NEW_RASTERIZER, + upload_SCISSOR_ENABLE }; @@ -274,8 +274,8 @@ static void upload_SCISSOR_RECT( struct i915_context *i915 ) const struct i915_tracked_state i915_upload_SCISSOR_RECT = { - .dirty = I915_NEW_SCISSOR, - .update = upload_SCISSOR_RECT + I915_NEW_SCISSOR, + upload_SCISSOR_RECT }; diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c index d830bb78e8..da2402c018 100644 --- a/src/mesa/pipe/i915simple/i915_state_immediate.c +++ b/src/mesa/pipe/i915simple/i915_state_immediate.c @@ -78,8 +78,8 @@ static void upload_S0S1(struct i915_context *i915) } const struct i915_tracked_state i915_upload_S0S1 = { - .dirty = I915_NEW_VBO | I915_NEW_VERTEX_FORMAT, - .update = upload_S0S1 + I915_NEW_VBO | I915_NEW_VERTEX_FORMAT, + upload_S0S1 }; @@ -115,8 +115,8 @@ static void upload_S2S4(struct i915_context *i915) const struct i915_tracked_state i915_upload_S2S4 = { - .dirty = I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT, - .update = upload_S2S4 + I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT, + upload_S2S4 }; @@ -147,8 +147,8 @@ static void upload_S5( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_S5 = { - .dirty = (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER), - .update = upload_S5 + (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER), + upload_S5 }; @@ -178,8 +178,8 @@ static void upload_S6( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_S6 = { - .dirty = I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, - .update = upload_S6 + I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, + upload_S6 }; @@ -187,11 +187,11 @@ const struct i915_tracked_state i915_upload_S6 = { */ static void upload_S7( struct i915_context *i915 ) { - float LIS7; + unsigned LIS7; /* I915_NEW_RASTERIZER */ - LIS7 = i915->rasterizer->LIS7; /* probably incorrect */ + LIS7 = i915->rasterizer->LIS7; if (LIS7 != i915->current.immediate[I915_IMMEDIATE_S7]) { i915->current.immediate[I915_IMMEDIATE_S7] = LIS7; @@ -200,8 +200,8 @@ static void upload_S7( struct i915_context *i915 ) } const struct i915_tracked_state i915_upload_S7 = { - .dirty = I915_NEW_RASTERIZER, - .update = upload_S7 + I915_NEW_RASTERIZER, + upload_S7 }; diff --git a/src/mesa/pipe/i915simple/i915_strings.c b/src/mesa/pipe/i915simple/i915_strings.c index a9b0bfc7c2..c713bf7208 100644 --- a/src/mesa/pipe/i915simple/i915_strings.c +++ b/src/mesa/pipe/i915simple/i915_strings.c @@ -70,7 +70,7 @@ static const char *i915_get_name( struct pipe_context *pipe ) break; } - snprintf(buffer, sizeof(buffer), "pipe/i915 (chipset: %s)", chipset); + sprintf(buffer, "pipe/i915 (chipset: %s)", chipset); return buffer; } diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c index afe15fb525..bec7ddb731 100644 --- a/src/mesa/pipe/i915simple/i915_surface.c +++ b/src/mesa/pipe/i915simple/i915_surface.c @@ -81,7 +81,7 @@ i915_get_tile_rgba(struct pipe_context *pipe, break; case PIPE_FORMAT_S8_Z24: { - const float scale = 1.0 / (float) 0xffffff; + const float scale = 1.0f / (float) 0xffffff; for (i = 0; i < h; i++) { float *pRow = p; for (j = 0; j < w; j++) { diff --git a/src/mesa/pipe/i915simple/i915_tex_layout.c b/src/mesa/pipe/i915simple/i915_tex_layout.c index 39c3cf2f71..cb372a7170 100644 --- a/src/mesa/pipe/i915simple/i915_tex_layout.c +++ b/src/mesa/pipe/i915simple/i915_tex_layout.c @@ -72,14 +72,14 @@ i915_miptree_set_level_info(struct pipe_mipmap_tree *mt, /* Not sure when this would happen, but anyway: */ if (mt->level[level].image_offset) { - free(mt->level[level].image_offset); + FREE(mt->level[level].image_offset); mt->level[level].image_offset = NULL; } assert(nr_images); assert(!mt->level[level].image_offset); - mt->level[level].image_offset = (unsigned *) malloc(nr_images * sizeof(unsigned)); + mt->level[level].image_offset = (unsigned *) MALLOC(nr_images * sizeof(unsigned)); mt->level[level].image_offset[0] = 0; } @@ -186,7 +186,7 @@ static const int step_offsets[6][2] = { boolean i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt) { - int level; + unsigned level; switch (mt->target) { case PIPE_TEXTURE_CUBE: { @@ -309,7 +309,7 @@ i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt) boolean i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt) { - int level; + unsigned level; switch (mt->target) { case PIPE_TEXTURE_CUBE:{ @@ -417,7 +417,7 @@ i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt) unsigned nr_images = mt->target == PIPE_TEXTURE_3D ? depth : 6; int x = 0; int y = 0; - int q, j; + unsigned q, j; i915_miptree_set_level_info(mt, level, nr_images, 0, mt->total_height, diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/mesa/pipe/i915simple/i915_winsys.h index 386ed745d3..2c0f335d34 100644 --- a/src/mesa/pipe/i915simple/i915_winsys.h +++ b/src/mesa/pipe/i915simple/i915_winsys.h @@ -52,7 +52,6 @@ struct pipe_buffer_handle; struct pipe_winsys; -struct pipe_fence; /** @@ -98,28 +97,8 @@ struct i915_winsys { unsigned access_flags, unsigned delta ); - /** - * Flush the batch buffer. - * - * Fence argument must point to NULL or to a previous fence, and the caller - * must call fence_reference when done with the fence. - */ - void (*batch_flush)( struct i915_winsys *sws, - struct pipe_fence **fence ); - - - /* Fence - */ - void (*fence_reference)( struct i915_winsys *sws, - struct pipe_fence **dst_fence, - struct pipe_fence *src_fence ); - - int (*fence_is_signalled)( struct i915_winsys *sws, - struct pipe_fence *fence ); - - int (*fence_wait)( struct i915_winsys *sws, - struct pipe_fence *fence ); - + void (*batch_flush)( struct i915_winsys *sws ); + void (*batch_finish)( struct i915_winsys *sws ); }; #define I915_BUFFER_ACCESS_WRITE 0x1 diff --git a/src/mesa/pipe/p_format.h b/src/mesa/pipe/p_format.h index f42f987c4e..70eb124709 100644 --- a/src/mesa/pipe/p_format.h +++ b/src/mesa/pipe/p_format.h @@ -97,16 +97,18 @@ static INLINE uint pf_get(pipe_format_rgbazs_t f, uint shift, uint mask) return (f >> shift) & mask; } -#define pf_swizzle_x(f) pf_get(f, 2, 0x7) /**< PIPE_FORMAT_COMP_ */ -#define pf_swizzle_y(f) pf_get(f, 5, 0x7) /**< PIPE_FORMAT_COMP_ */ -#define pf_swizzle_z(f) pf_get(f, 8, 0x7) /**< PIPE_FORMAT_COMP_ */ -#define pf_swizzle_w(f) pf_get(f, 11, 0x7) /**< PIPE_FORMAT_COMP_ */ -#define pf_size_x(f) pf_get(f, 14, 0x7) /**< Size of X - 1 */ -#define pf_size_y(f) pf_get(f, 17, 0x7) /**< Size of Y - 1 */ -#define pf_size_z(f) pf_get(f, 20, 0x7) /**< Size of Z - 1 */ -#define pf_size_w(f) pf_get(f, 23, 0x7) /**< Size of W - 1 */ -#define pf_exp8(f) pf_get(f, 26, 0x3) /**< Scale size by 8 ^ exp8 */ -#define pf_type(f) pf_get(f, 28, 0xf) /**< PIPE_FORMAT_TYPE_ */ +#define pf_swizzle_x(f) pf_get(f, 2, 0x7) /**< PIPE_FORMAT_COMP_ */ +#define pf_swizzle_y(f) pf_get(f, 5, 0x7) /**< PIPE_FORMAT_COMP_ */ +#define pf_swizzle_z(f) pf_get(f, 8, 0x7) /**< PIPE_FORMAT_COMP_ */ +#define pf_swizzle_w(f) pf_get(f, 11, 0x7) /**< PIPE_FORMAT_COMP_ */ +#define pf_swizzle_xyzw(f,i) pf_get(f, 2+((i)*3), 0x7) +#define pf_size_x(f) pf_get(f, 14, 0x7) /**< Size of X */ +#define pf_size_y(f) pf_get(f, 17, 0x7) /**< Size of Y */ +#define pf_size_z(f) pf_get(f, 20, 0x7) /**< Size of Z */ +#define pf_size_w(f) pf_get(f, 23, 0x7) /**< Size of W */ +#define pf_size_xyzw(f,i) pf_get(f, 14+((i)*3), 0x7) +#define pf_exp8(f) pf_get(f, 26, 0x3) /**< Scale size by 8 ^ exp8 */ +#define pf_type(f) pf_get(f, 28, 0xf) /**< PIPE_FORMAT_TYPE_ */ /** * Helper macro to encode the above structure into a 32-bit value. @@ -127,31 +129,19 @@ static INLINE uint pf_get(pipe_format_rgbazs_t f, uint shift, uint mask) #define _PIPE_FORMAT_SWZ( SWZX, SWZY, SWZZ, SWZW ) (((SWZX) << 0) | ((SWZY) << 3) | ((SWZZ) << 6) | ((SWZW) << 9)) /** - * Shorthand macro for RGBAZS layout with uniform component sizes in 1-bit units. + * Shorthand macro for RGBAZS layout with component sizes in 1-bit units. */ -#define _PIPE_FORMAT_RGBAZS_1U( SWZ, SIZE, TYPE )\ - _PIPE_FORMAT_RGBAZS( SWZ, SIZE, SIZE, SIZE, SIZE, 0, TYPE ) - -/** - * Shorthand macro for RGBAZS layout with non-uniform component sizes in 1-bit units. - */ -#define _PIPE_FORMAT_RGBAZS_1N( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\ +#define _PIPE_FORMAT_RGBAZS_1( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\ _PIPE_FORMAT_RGBAZS( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, 0, TYPE ) /** - * Shorthand macro for RGBAZS layout with uniform component sizes in 8-bit units. - */ -#define _PIPE_FORMAT_RGBAZS_8U( SWZ, SIZE, TYPE )\ - _PIPE_FORMAT_RGBAZS( SWZ, SIZE, SIZE, SIZE, SIZE, 1, TYPE ) - -/** - * Shorthand macro for RGBAZS layout with non-uniform component sizes in 8-bit units. + * Shorthand macro for RGBAZS layout with component sizes in 8-bit units. */ -#define _PIPE_FORMAT_RGBAZS_8N( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\ +#define _PIPE_FORMAT_RGBAZS_8( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\ _PIPE_FORMAT_RGBAZS( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, 1, TYPE ) /** - * Shorthand macro for RGBAZS layout with non-uniform component sizes in 64-bit units. + * Shorthand macro for RGBAZS layout with component sizes in 64-bit units. */ #define _PIPE_FORMAT_RGBAZS_64( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\ _PIPE_FORMAT_RGBAZS( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, 2, TYPE ) @@ -207,83 +197,178 @@ static INLINE uint pf_rev(pipe_format_ycbcr_t f) * z24s8, compressed textures, ycbcr, etc that won't fit that model. */ -#define PIPE_FORMAT_NONE _PIPE_FORMAT_RGBAZS_1U( _PIPE_FORMAT_0000, 0, PIPE_FORMAT_TYPE_UNKNOWN ) /**< unstructured */ -#define PIPE_FORMAT_U_A8_R8_G8_B8 _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_ARGB, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte[4] ARGB */ -#define PIPE_FORMAT_U_A1_R5_G5_B5 _PIPE_FORMAT_RGBAZS_1N( _PIPE_FORMAT_ARGB, 1, 5, 5, 5, PIPE_FORMAT_TYPE_UNORM ) /**< 16-bit packed RGBA */ -#define PIPE_FORMAT_U_A4_R4_G4_B4 _PIPE_FORMAT_RGBAZS_1U( _PIPE_FORMAT_ARGB, 4, PIPE_FORMAT_TYPE_UNORM ) /**< 16-bit packed RGBA */ -#define PIPE_FORMAT_U_R5_G6_B5 _PIPE_FORMAT_RGBAZS_1N( _PIPE_FORMAT_RGB0, 5, 6, 5, 0, PIPE_FORMAT_TYPE_UNORM ) /**< 16-bit packed RGB */ -#define PIPE_FORMAT_U_L8 _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RRR1, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte luminance */ -#define PIPE_FORMAT_U_A8 _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_000R, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte alpha */ -#define PIPE_FORMAT_U_I8 _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RRRR, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte intensity */ -#define PIPE_FORMAT_U_A8_L8 _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RRRG, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte alpha, luminance */ -#define PIPE_FORMAT_S_R16_G16_B16_A16 _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RGBA, 2, PIPE_FORMAT_TYPE_SNORM ) /**< signed 16-bit RGBA (accum) */ +#define PIPE_FORMAT_NONE _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_0000, 0, 0, 0, 0, PIPE_FORMAT_TYPE_UNKNOWN ) +#define PIPE_FORMAT_A8R8G8B8_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_ARGB, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_A1R5G5B5_UNORM _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_ARGB, 1, 5, 5, 5, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_A4R4G4B4_UNORM _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_ARGB, 4, 4, 4, 4, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R5G6B5_UNORM _PIPE_FORMAT_RGBAZS_1 ( _PIPE_FORMAT_RGB0, 5, 6, 5, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_U_L8 _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRR1, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte luminance */ +#define PIPE_FORMAT_U_A8 _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_000R, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte alpha */ +#define PIPE_FORMAT_U_I8 _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRRR, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte intensity */ +#define PIPE_FORMAT_U_A8_L8 _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RRRG, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ) /**< ubyte alpha, luminance */ #define PIPE_FORMAT_YCBCR _PIPE_FORMAT_YCBCR( 0 ) #define PIPE_FORMAT_YCBCR_REV _PIPE_FORMAT_YCBCR( 1 ) -#define PIPE_FORMAT_U_Z16 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_Z000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) /**< ushort Z/depth */ -#define PIPE_FORMAT_U_Z32 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_Z000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) /**< uint Z/depth */ -#define PIPE_FORMAT_F_Z32 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_Z000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) /**< float Z/depth */ -#define PIPE_FORMAT_S8_Z24 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_SZ00, 1, 3, 0, 0, PIPE_FORMAT_TYPE_UNORM ) /**< 8-bit stencil + 24-bit Z */ -#define PIPE_FORMAT_Z24_S8 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_ZS00, 3, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ) /**< 24-bit Z + 8-bit stencil */ -#define PIPE_FORMAT_U_S8 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_S000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) /**< 8-bit stencil */ +#define PIPE_FORMAT_Z16_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_Z000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_Z32_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_Z000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_Z32_FLOAT _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_Z000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) +#define PIPE_FORMAT_S8Z24_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_SZ00, 1, 3, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_Z24S8_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_ZS00, 3, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_S8_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_S000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) #define PIPE_FORMAT_R64_FLOAT _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) #define PIPE_FORMAT_R64G64_FLOAT _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) #define PIPE_FORMAT_R64G64B64_FLOAT _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_FLOAT ) #define PIPE_FORMAT_R64G64B64A64_FLOAT _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_FLOAT ) -#define PIPE_FORMAT_R32_FLOAT _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) -#define PIPE_FORMAT_R32G32_FLOAT _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) -#define PIPE_FORMAT_R32G32B32_FLOAT _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_FLOAT ) -#define PIPE_FORMAT_R32G32B32A32_FLOAT _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_FLOAT ) -#define PIPE_FORMAT_R32_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R32G32_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R32G32B32_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R32G32B32A32_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R32_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R32G32_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R32G32B32_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R32G32B32A32_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R32_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R32G32_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R32G32B32_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R32G32B32A32_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R32_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R32G32_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R32G32B32_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R32G32B32A32_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R16_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R16G16_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R16G16B16_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R16G16B16A16_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R16_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R16G16_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R16G16B16_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R16G16B16A16_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R16_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R16G16_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R16G16B16_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R16G16B16A16_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R16_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R16G16_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R16G16B16_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R16G16B16A16_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R8_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R8G8_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R8G8B8_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R8G8B8A8_UNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ) -#define PIPE_FORMAT_R8_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R8G8_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R8G8B8_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R8G8B8A8_USCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_USCALED ) -#define PIPE_FORMAT_R8_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R8G8_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R8G8B8_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R8G8B8A8_SNORM _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SNORM ) -#define PIPE_FORMAT_R8_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R8G8_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R8G8B8_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SSCALED ) -#define PIPE_FORMAT_R8G8B8A8_SSCALED _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R32_FLOAT _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) +#define PIPE_FORMAT_R32G32_FLOAT _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_FLOAT ) +#define PIPE_FORMAT_R32G32B32_FLOAT _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_FLOAT ) +#define PIPE_FORMAT_R32G32B32A32_FLOAT _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_FLOAT ) +#define PIPE_FORMAT_R32_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R32G32_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R32G32B32_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R32G32B32A32_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R32_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R32G32_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R32G32B32_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R32G32B32A32_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R32_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R32G32_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R32G32B32_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R32G32B32A32_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R32_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R32G32_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R32G32B32_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R32G32B32A32_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R16_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R16G16_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R16G16B16_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R16G16B16A16_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R16_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R16G16_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R16G16B16_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R16G16B16A16_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R16_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R16G16_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R16G16B16_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R16G16B16A16_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R16_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R16G16_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R16G16B16_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R16G16B16A16_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R8_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R8G8_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R8G8B8_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R8G8B8A8_UNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM ) +#define PIPE_FORMAT_R8_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R8G8_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R8G8B8_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R8G8B8A8_USCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_USCALED ) +#define PIPE_FORMAT_R8_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R8G8_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R8G8B8_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R8G8B8A8_SNORM _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SNORM ) +#define PIPE_FORMAT_R8_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R8G8_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R8G8B8_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SSCALED ) +#define PIPE_FORMAT_R8G8B8A8_SSCALED _PIPE_FORMAT_RGBAZS_8 ( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SSCALED ) -/* Duplicated formats: +/** + * Duplicated formats: */ +#define PIPE_FORMAT_U_A8_R8_G8_B8 PIPE_FORMAT_A8R8G8B8_UNORM +#define PIPE_FORMAT_U_A1_R5_G5_B5 PIPE_FORMAT_A1R5G5B5_UNORM +#define PIPE_FORMAT_U_A4_R4_G4_B4 PIPE_FORMAT_A4R4G4B4_UNORM #define PIPE_FORMAT_U_R8_G8_B8_A8 PIPE_FORMAT_R8G8B8A8_UNORM +#define PIPE_FORMAT_U_R5_G6_B5 PIPE_FORMAT_R5G6B5_UNORM +#define PIPE_FORMAT_S_R16_G16_B16_A16 PIPE_FORMAT_R16G16B16A16_SNORM +#define PIPE_FORMAT_U_Z16 PIPE_FORMAT_Z16_UNORM +#define PIPE_FORMAT_U_Z32 PIPE_FORMAT_Z32_UNORM +#define PIPE_FORMAT_F_Z32 PIPE_FORMAT_Z32_FLOAT +#define PIPE_FORMAT_S8_Z24 PIPE_FORMAT_S8Z24_UNORM +#define PIPE_FORMAT_Z24_S8 PIPE_FORMAT_Z24S8_UNORM +#define PIPE_FORMAT_U_S8 PIPE_FORMAT_S8_UNORM + +/** + * Builds pipe format name from format token. + */ +static INLINE char *pf_sprint_name( char *str, uint format ) +{ + strcpy( str, "PIPE_FORMAT_" ); + switch (pf_layout( format )) { + case PIPE_FORMAT_LAYOUT_RGBAZS: { + pipe_format_rgbazs_t rgbazs = (pipe_format_rgbazs_t) format; + uint i; + uint scale = 1 << (pf_exp8( rgbazs ) * 3); + + for (i = 0; i < 4; i++) { + uint size = pf_size_xyzw( rgbazs, i ); + + if (size == 0) { + break; + } + switch (pf_swizzle_xyzw( rgbazs, i )) { + case PIPE_FORMAT_COMP_R: + strcat( str, "R" ); + break; + case PIPE_FORMAT_COMP_G: + strcat( str, "G" ); + break; + case PIPE_FORMAT_COMP_B: + strcat( str, "B" ); + break; + case PIPE_FORMAT_COMP_A: + strcat( str, "A" ); + break; + case PIPE_FORMAT_COMP_0: + strcat( str, "0" ); + break; + case PIPE_FORMAT_COMP_1: + strcat( str, "1" ); + break; + case PIPE_FORMAT_COMP_Z: + strcat( str, "Z" ); + break; + case PIPE_FORMAT_COMP_S: + strcat( str, "S" ); + break; + } + sprintf( &str[strlen( str )], "%u", size * scale ); + } + if (i != 0) { + strcat( str, "_" ); + } + switch (pf_type( rgbazs )) { + case PIPE_FORMAT_TYPE_UNKNOWN: + strcat( str, "NONE" ); + break; + case PIPE_FORMAT_TYPE_FLOAT: + strcat( str, "FLOAT" ); + break; + case PIPE_FORMAT_TYPE_UNORM: + strcat( str, "UNORM" ); + break; + case PIPE_FORMAT_TYPE_SNORM: + strcat( str, "SNORM" ); + break; + case PIPE_FORMAT_TYPE_USCALED: + strcat( str, "USCALED" ); + break; + case PIPE_FORMAT_TYPE_SSCALED: + strcat( str, "SSCALED" ); + break; + } + } + break; + case PIPE_FORMAT_LAYOUT_YCBCR: { + pipe_format_ycbcr_t ycbcr = (pipe_format_ycbcr_t) format; + + strcat( str, "YCBCR" ); + if (pf_rev( ycbcr )) { + strcat( str, "_REV" ); + } + } + break; + } + return str; +} #endif diff --git a/src/mesa/pipe/tgsi/exec/tgsi_token.h b/src/mesa/pipe/p_shader_tokens.h index 2b922c7aef..e5922b439f 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_token.h +++ b/src/mesa/pipe/p_shader_tokens.h @@ -158,13 +158,9 @@ struct tgsi_immediate_float32 /* * GL_ATI_fragment_shader */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_MUL */ #define TGSI_OPCODE_SUB 17 #define TGSI_OPCODE_DOT3 TGSI_OPCODE_DP3 #define TGSI_OPCODE_DOT4 TGSI_OPCODE_DP4 -/* TGSI_OPCODE_MAD */ #define TGSI_OPCODE_LERP 18 #define TGSI_OPCODE_CND 19 #define TGSI_OPCODE_CND0 20 @@ -175,14 +171,8 @@ struct tgsi_immediate_float32 */ #define TGSI_OPCODE_INDEX 22 #define TGSI_OPCODE_NEGATE 23 -/* TGSI_OPCODE_DOT3 */ -/* TGSI_OPCODE_DOT4 */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_ADD */ #define TGSI_OPCODE_MADD TGSI_OPCODE_MAD #define TGSI_OPCODE_FRAC 24 -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ #define TGSI_OPCODE_SETGE TGSI_OPCODE_SGE #define TGSI_OPCODE_SETLT TGSI_OPCODE_SLT #define TGSI_OPCODE_CLAMP 25 @@ -193,79 +183,43 @@ struct tgsi_immediate_float32 #define TGSI_OPCODE_POWER 30 #define TGSI_OPCODE_RECIP TGSI_OPCODE_RCP #define TGSI_OPCODE_RECIPSQRT TGSI_OPCODE_RSQ -/* TGSI_OPCODE_SUB */ #define TGSI_OPCODE_CROSSPRODUCT 31 #define TGSI_OPCODE_MULTIPLYMATRIX 32 -/* TGSI_OPCODE_MOV */ /* * GL_NV_vertex_program1_1 */ -/* TGSI_OPCODE_ARL */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_LIT */ #define TGSI_OPCODE_ABS 33 -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_EXP */ -/* TGSI_OPCODE_LOG */ #define TGSI_OPCODE_RCC 34 -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SGE */ #define TGSI_OPCODE_DPH 35 -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ /* * GL_NV_fragment_program */ -/* TGSI_OPCODE_ADD */ #define TGSI_OPCODE_COS 36 #define TGSI_OPCODE_DDX 37 #define TGSI_OPCODE_DDY 38 -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DST */ #define TGSI_OPCODE_EX2 TGSI_OPCODE_EXPBASE2 #define TGSI_OPCODE_FLR TGSI_OPCODE_FLOOR #define TGSI_OPCODE_FRC TGSI_OPCODE_FRAC #define TGSI_OPCODE_KILP 39 /* predicated kill */ #define TGSI_OPCODE_LG2 TGSI_OPCODE_LOGBASE2 -/* TGSI_OPCODE_LIT */ #define TGSI_OPCODE_LRP TGSI_OPCODE_LERP -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_MUL */ #define TGSI_OPCODE_PK2H 40 #define TGSI_OPCODE_PK2US 41 #define TGSI_OPCODE_PK4B 42 #define TGSI_OPCODE_PK4UB 43 #define TGSI_OPCODE_POW TGSI_OPCODE_POWER -/* TGSI_OPCODE_RCP */ #define TGSI_OPCODE_RFL 44 -/* TGSI_OPCODE_RSQ */ #define TGSI_OPCODE_SEQ 45 #define TGSI_OPCODE_SFL 46 -/* TGSI_OPCODE_SGE */ #define TGSI_OPCODE_SGT 47 #define TGSI_OPCODE_SIN 48 #define TGSI_OPCODE_SLE 49 -/* TGSI_OPCODE_SLT */ #define TGSI_OPCODE_SNE 50 #define TGSI_OPCODE_STR 51 -/* TGSI_OPCODE_SUB */ #define TGSI_OPCODE_TEX 52 #define TGSI_OPCODE_TXD 53 -/* TGSI_OPCODE_TXP */ #define TGSI_OPCODE_UP2H 54 #define TGSI_OPCODE_UP2US 55 #define TGSI_OPCODE_UP4B 56 @@ -275,232 +229,39 @@ struct tgsi_immediate_float32 /* * GL_NV_vertex_program2 */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_ADD */ #define TGSI_OPCODE_ARA 59 -/* TGSI_OPCODE_ARL */ #define TGSI_OPCODE_ARR 60 #define TGSI_OPCODE_BRA 61 #define TGSI_OPCODE_CAL 62 -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_EXP */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_LOG */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_RCC */ -/* TGSI_OPCODE_RCP */ #define TGSI_OPCODE_RET 63 -/* TGSI_OPCODE_RSQNV - use TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SFL */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SNE */ #define TGSI_OPCODE_SSG 64 -/* TGSI_OPCODE_STR */ -/* TGSI_OPCODE_SUB */ /* * GL_ARB_vertex_program */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_ARL */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_EXP */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_LOG */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SUB */ #define TGSI_OPCODE_SWZ TGSI_OPCODE_MOV #define TGSI_OPCODE_XPD TGSI_OPCODE_CROSSPRODUCT /* * GL_ARB_fragment_program */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_ADD */ #define TGSI_OPCODE_CMP 65 -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ #define TGSI_OPCODE_SCS 66 -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_SWZ */ -/* TGSI_OPCODE_XPD */ -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TXP */ #define TGSI_OPCODE_TXB 67 -/* TGSI_OPCODE_KIL */ /* * GL_NV_fragment_program_option */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_DDX */ -/* TGSI_OPCODE_DDY */ -/* TGSI_OPCODE_PK2H */ -/* TGSI_OPCODE_PK2US */ -/* TGSI_OPCODE_PK4B */ -/* TGSI_OPCODE_PK4UB */ -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_SCS */ -/* TGSI_OPCODE_UP2H */ -/* TGSI_OPCODE_UP2US */ -/* TGSI_OPCODE_UP4B */ -/* TGSI_OPCODE_UP4UB */ -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_XPD */ -/* TGSI_OPCODE_RFL */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SFL */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SNE */ -/* TGSI_OPCODE_STR */ -/* TGSI_OPCODE_CMP */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_X2D */ -/* TGSI_OPCODE_SWZ */ -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TXP */ -/* TGSI_OPCODE_TXB */ -/* TGSI_OPCODE_KIL */ -/* TGSI_OPCODE_TXD */ +/* No new opcode */ /* * GL_NV_fragment_program2 */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_DDX */ -/* TGSI_OPCODE_DDY */ -/* TGSI_OPCODE_PK2H */ -/* TGSI_OPCODE_PK2US */ -/* TGSI_OPCODE_PK4B */ -/* TGSI_OPCODE_PK4UB */ #define TGSI_OPCODE_NRM 68 #define TGSI_OPCODE_DIV 69 -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_SCS */ -/* TGSI_OPCODE_UP2H */ -/* TGSI_OPCODE_UP2US */ -/* TGSI_OPCODE_UP4B */ -/* TGSI_OPCODE_UP4UB */ -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_XPD */ -/* TGSI_OPCODE_RFL */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SFL */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SNE */ -/* TGSI_OPCODE_STR */ #define TGSI_OPCODE_DP2 70 -/* TGSI_OPCODE_CMP */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_X2D */ #define TGSI_OPCODE_DP2A TGSI_OPCODE_DOT2ADD -/* TGSI_OPCODE_SWZ */ -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TXP */ -/* TGSI_OPCODE_TXB */ #define TGSI_OPCODE_TXL 71 -/* TGSI_OPCODE_KIL */ -/* TGSI_OPCODE_TXD */ -/* TGSI_OPCODE_CAL */ -/* TGSI_OPCODE_RET */ #define TGSI_OPCODE_BRK 72 #define TGSI_OPCODE_IF 73 #define TGSI_OPCODE_LOOP 74 @@ -513,183 +274,30 @@ struct tgsi_immediate_float32 /* * GL_NV_vertex_program2_option */ -/* TGSI_OPCODE_ARL */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_SSG */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_EXP */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LOG */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_RCC */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_XPD */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SFL */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SNE */ -/* TGSI_OPCODE_STR */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_SWZ */ -/* TGSI_OPCODE_ARR */ -/* TGSI_OPCODE_ARA */ -/* TGSI_OPCODE_BRA */ -/* TGSI_OPCODE_CAL */ -/* TGSI_OPCODE_RET */ /* * GL_NV_vertex_program3 */ -/* TGSI_OPCODE_ARL */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_SSG */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_EXP */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LOG */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_RCC */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_XPD */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SFL */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SNE */ -/* TGSI_OPCODE_STR */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_SWZ */ -/* TGSI_OPCODE_ARR */ -/* TGSI_OPCODE_ARA */ -/* TGSI_OPCODE_BRA */ -/* TGSI_OPCODE_CAL */ -/* TGSI_OPCODE_RET */ #define TGSI_OPCODE_PUSHA 80 #define TGSI_OPCODE_POPA 81 -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TXP */ -/* TGSI_OPCODE_TXB */ -/* TGSI_OPCODE_TXL */ /* * GL_NV_gpu_program4 */ -/* TGSI_OPCODE_ABS */ #define TGSI_OPCODE_CEIL 82 -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ #define TGSI_OPCODE_I2F 83 -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_MOV */ #define TGSI_OPCODE_NOT 84 -/* TGSI_OPCODE_NRM */ -/* TGSI_OPCODE_PK2H */ -/* TGSI_OPCODE_PK2US */ -/* TGSI_OPCODE_PK4B */ -/* TGSI_OPCODE_PK4UB */ -/* TGSI_OPCODE_ROUND */ -/* TGSI_OPCODE_SSG */ #define TGSI_OPCODE_TRUNC 85 -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_RCC */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_SCS */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_UP2H */ -/* TGSI_OPCODE_UP2US */ -/* TGSI_OPCODE_UP4B */ -/* TGSI_OPCODE_UP4UB */ -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_DIV */ #define TGSI_OPCODE_SHL 86 #define TGSI_OPCODE_SHR 87 -/* TGSI_OPCODE_ADD */ #define TGSI_OPCODE_AND 88 -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_DPH */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MUL */ #define TGSI_OPCODE_OR 89 -/* TGSI_OPCODE_RFL */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SFL */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SNE */ -/* TGSI_OPCODE_STR */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_XPD */ -/* TGSI_OPCODE_DP2 */ #define TGSI_OPCODE_MOD 90 #define TGSI_OPCODE_XOR 91 -/* TGSI_OPCODE_CMP */ -/* TGSI_OPCODE_DP2A */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_MAD */ #define TGSI_OPCODE_SAD 92 -/* TGSI_OPCODE_X2D */ -/* TGSI_OPCODE_SWZ */ -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TXB */ #define TGSI_OPCODE_TXF 93 -/* TGSI_OPCODE_TXL */ -/* TGSI_OPCODE_TXP */ #define TGSI_OPCODE_TXQ 94 -/* TGSI_OPCODE_TXD */ -/* TGSI_OPCODE_CAL */ -/* TGSI_OPCODE_RET */ -/* TGSI_OPCODE_BRK */ #define TGSI_OPCODE_CONT 95 -/* TGSI_OPCODE_IF */ -/* TGSI_OPCODE_REP */ -/* TGSI_OPCODE_ELSE */ -/* TGSI_OPCODE_ENDIF */ -/* TGSI_OPCODE_ENDREP */ /* * GL_NV_vertex_program4 @@ -700,9 +308,6 @@ struct tgsi_immediate_float32 * GL_NV_fragment_program4 */ /* Same as GL_NV_gpu_program4 */ -/* TGSI_OPCODE_KIL */ -/* TGSI_OPCODE_DDX */ -/* TGSI_OPCODE_DDY */ /* * GL_NV_geometry_program4 @@ -714,73 +319,22 @@ struct tgsi_immediate_float32 /* * GLSL */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_ADD */ #define TGSI_OPCODE_BGNLOOP2 98 #define TGSI_OPCODE_BGNSUB 99 -/* TGSI_OPCODE_BRA */ -/* TGSI_OPCODE_BRK */ -/* TGSI_OPCODE_CONT */ -/* TGSI_OPCODE_COS */ -/* TGSI_OPCODE_DDX */ -/* TGSI_OPCODE_DDY */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_ELSE */ -/* TGSI_OPCODE_ENDIF */ #define TGSI_OPCODE_ENDLOOP2 100 #define TGSI_OPCODE_ENDSUB 101 -/* TGSI_OPCODE_EX2 */ -/* TGSI_OPCODE_EXP */ -/* TGSI_OPCODE_FLR */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_IF */ #define TGSI_OPCODE_INT TGSI_OPCODE_TRUNC -/* TGSI_OPCODE_KIL */ -/* TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LOG */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_MUL */ #define TGSI_OPCODE_NOISE1 102 #define TGSI_OPCODE_NOISE2 103 #define TGSI_OPCODE_NOISE3 104 #define TGSI_OPCODE_NOISE4 105 #define TGSI_OPCODE_NOP 106 -/* TGSI_OPCODE_POW */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SIN */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SNE */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TXB */ -/* TGSI_OPCODE_TXD */ -/* TGSI_OPCODE_TXL */ -/* TGSI_OPCODE_TXP */ -/* TGSI_OPCODE_XPD */ /* * ps_1_1 */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_LRP */ #define TGSI_OPCODE_TEXCOORD TGSI_OPCODE_NOP #define TGSI_OPCODE_TEXKILL TGSI_OPCODE_KIL -/* TGSI_OPCODE_TEX */ #define TGSI_OPCODE_TEXBEM 107 #define TGSI_OPCODE_TEXBEML 108 #define TGSI_OPCODE_TEXREG2AR 109 @@ -790,34 +344,11 @@ struct tgsi_immediate_float32 #define TGSI_OPCODE_TEXM3X3TEX 113 #define TGSI_OPCODE_TEXM3X3SPEC 114 #define TGSI_OPCODE_TEXM3X3VSPEC 115 -/* TGSI_OPCODE_CND */ /* * ps_1_2 */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_TEXCOORD */ -/* TGSI_OPCODE_TEXKILL */ -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TEXBEM */ -/* TGSI_OPCODE_TEXBEML */ -/* TGSI_OPCODE_TEXREG2AR */ #define TGSI_OPCODE_TEXREG2GB 116 -/* TGSI_OPCODE_TEXM3X2PAD */ -/* TGSI_OPCODE_TEXM3X2TEX */ -/* TGSI_OPCODE_TEXM3X3PAD */ -/* TGSI_OPCODE_TEXM3X3TEX */ -/* TGSI_OPCODE_TEXM3X3SPEC */ -/* TGSI_OPCODE_TEXM3X3VSPEC */ -/* TGSI_OPCODE_CND */ #define TGSI_OPCODE_TEXREG2RGB 117 #define TGSI_OPCODE_TEXDP3TEX 118 #define TGSI_OPCODE_TEXDP3 119 @@ -827,278 +358,58 @@ struct tgsi_immediate_float32 /* * ps_1_3 */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_TEXCOORD */ -/* TGSI_OPCODE_TEXKILL */ -/* TGSI_OPCODE_TEX */ -/* TGSI_OPCODE_TEXBEM */ -/* TGSI_OPCODE_TEXBEML */ -/* TGSI_OPCODE_TEXREG2AR */ -/* TGSI_OPCODE_TEXREG2GB */ -/* TGSI_OPCODE_TEXM3X2PAD */ -/* TGSI_OPCODE_TEXM3X2TEX */ -/* TGSI_OPCODE_TEXM3X3PAD */ -/* TGSI_OPCODE_TEXM3X3TEX */ -/* TGSI_OPCODE_TEXM3X3SPEC */ -/* TGSI_OPCODE_TEXM3X3VSPEC */ -/* TGSI_OPCODE_CND */ -/* TGSI_OPCODE_TEXREG2RGB */ -/* TGSI_OPCODE_TEXDP3TEX */ #define TGSI_OPCODE_TEXM3X2DEPTH 121 -/* TGSI_OPCODE_TEXDP3 */ -/* TGSI_OPCODE_TEXM3X3 */ /* CMP - use TGSI_OPCODE_CND0 */ /* * ps_1_4 */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_LRP */ #define TGSI_OPCODE_TEXCRD TGSI_OPCODE_TEXCOORD -/* TGSI_OPCODE_TEXKILL */ #define TGSI_OPCODE_TEXLD TGSI_OPCODE_TEX -/* TGSI_OPCODE_CND */ #define TGSI_OPCODE_TEXDEPTH 122 -/* CMP - use TGSI_OPCODE_CND0 */ #define TGSI_OPCODE_BEM 123 /* * ps_2_0 */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ /* XXX: takes ABS */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MAX */ -/* EXP - use TGSI_OPCODE_EX2 */ -/* LOG - use TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_FRC */ #define TGSI_OPCODE_M4X4 TGSI_OPCODE_MULTIPLYMATRIX #define TGSI_OPCODE_M4X3 124 #define TGSI_OPCODE_M3X4 125 #define TGSI_OPCODE_M3X3 126 #define TGSI_OPCODE_M3X2 127 -/* TGSI_OPCODE_POW */ /* XXX: takes ABS */ #define TGSI_OPCODE_CRS TGSI_OPCODE_XPD -/* TGSI_OPCODE_ABS */ #define TGSI_OPCODE_NRM4 128 #define TGSI_OPCODE_SINCOS TGSI_OPCODE_SCS -/* TGSI_OPCODE_TEXKILL */ -/* TGSI_OPCODE_TEXLD */ #define TGSI_OPCODE_TEXLDB TGSI_OPCODE_TXB -/* TGSI_OPCODE_TEXLDP */ -/* CMP - use TGSI_OPCODE_CND0 */ #define TGSI_OPCODE_DP2ADD TGSI_OPCODE_DP2A /* * ps_2_x */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ /* XXX: takes ABS */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SNE */ -/* EXP - use TGSI_OPCODE_EX2 */ -/* LOG - use TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_M4X4 */ -/* TGSI_OPCODE_M4X3 */ -/* TGSI_OPCODE_M3X4 */ -/* TGSI_OPCODE_M3X3 */ -/* TGSI_OPCODE_M3X2 */ #define TGSI_OPCODE_CALL TGSI_OPCODE_CAL #define TGSI_OPCODE_CALLNZ 129 -/* TGSI_OPCODE_RET */ -/* TGSI_OPCODE_POW */ /* XXX: takes ABS */ -/* TGSI_OPCODE_CRS */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_NRM4 */ -/* TGSI_OPCODE_SINCOS */ -/* TGSI_OPCODE_REP */ -/* TGSI_OPCODE_ENDREP */ -/* TGSI_OPCODE_IF */ #define TGSI_OPCODE_IFC 130 -/* TGSI_OPCODE_ELSE */ -/* TGSI_OPCODE_ENDIF */ #define TGSI_OPCODE_BREAK TGSI_OPCODE_BRK #define TGSI_OPCODE_BREAKC 131 -/* TGSI_OPCODE_TEXKILL */ -/* TGSI_OPCODE_TEXLD */ -/* TGSI_OPCODE_TEXLDB */ -/* CMP - use TGSI_OPCODE_CND0 */ -/* TGSI_OPCODE_DP2ADD */ #define TGSI_OPCODE_DSX TGSI_OPCODE_DDX #define TGSI_OPCODE_DSY TGSI_OPCODE_DDY #define TGSI_OPCODE_TEXLDD TGSI_OPCODE_TXD -/* TGSI_OPCODE_TEXLDP */ /* * vs_1_1 */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ /* XXX: takes ABS */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SGE */ -/* EXP - use TGSI_OPCODE_EX2 */ -/* LOG - use TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_M4X4 */ -/* TGSI_OPCODE_M4X3 */ -/* TGSI_OPCODE_M3X4 */ -/* TGSI_OPCODE_M3X3 */ -/* TGSI_OPCODE_M3X2 */ #define TGSI_OPCODE_EXPP TGSI_OPCODE_EXP #define TGSI_OPCODE_LOGP TGSI_OPCODE_LG2 /* * vs_2_0 */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ /* XXX: takes ABS */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SGE */ -/* EXP - use TGSI_OPCODE_EX2 */ -/* LOG - use TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_M4X4 */ -/* TGSI_OPCODE_M4X3 */ -/* TGSI_OPCODE_M3X4 */ -/* TGSI_OPCODE_M3X3 */ -/* TGSI_OPCODE_M3X2 */ -/* TGSI_OPCODE_CALL */ -/* TGSI_OPCODE_CALLNZ */ -/* TGSI_OPCODE_LOOP */ -/* TGSI_OPCODE_RET */ -/* TGSI_OPCODE_ENDLOOP */ -/* TGSI_OPCODE_POW */ /* XXX: takes ABS */ -/* TGSI_OPCODE_CRS */ #define TGSI_OPCODE_SGN TGSI_OPCODE_SSG -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_NRM4 */ -/* TGSI_OPCODE_SINCOS */ -/* TGSI_OPCODE_REP */ -/* TGSI_OPCODE_ENDREP */ -/* TGSI_OPCODE_IF */ -/* TGSI_OPCODE_ELSE */ -/* TGSI_OPCODE_ENDIF */ #define TGSI_OPCODE_MOVA TGSI_OPCODE_ARR -/* TGSI_OPCODE_LOGP */ /* * vs_2_x */ -/* TGSI_OPCODE_NOP */ -/* TGSI_OPCODE_MOV */ -/* TGSI_OPCODE_ADD */ -/* TGSI_OPCODE_SUB */ -/* TGSI_OPCODE_MAD */ -/* TGSI_OPCODE_MUL */ -/* TGSI_OPCODE_RCP */ -/* TGSI_OPCODE_RSQ */ /* XXX: takes ABS */ -/* TGSI_OPCODE_DP3 */ -/* TGSI_OPCODE_DP4 */ -/* TGSI_OPCODE_MIN */ -/* TGSI_OPCODE_MAX */ -/* TGSI_OPCODE_SLT */ -/* TGSI_OPCODE_SGE */ -/* TGSI_OPCODE_SGT */ -/* TGSI_OPCODE_SLE */ -/* TGSI_OPCODE_SEQ */ -/* TGSI_OPCODE_SNE */ -/* EXP - use TGSI_OPCODE_EX2 */ -/* LOG - use TGSI_OPCODE_LG2 */ -/* TGSI_OPCODE_LIT */ -/* TGSI_OPCODE_DST */ -/* TGSI_OPCODE_LRP */ -/* TGSI_OPCODE_FRC */ -/* TGSI_OPCODE_M4X4 */ -/* TGSI_OPCODE_M4X3 */ -/* TGSI_OPCODE_M3X4 */ -/* TGSI_OPCODE_M3X3 */ -/* TGSI_OPCODE_M3X2 */ -/* TGSI_OPCODE_CALL */ -/* TGSI_OPCODE_CALLNZ */ -/* TGSI_OPCODE_LOOP */ -/* TGSI_OPCODE_RET */ -/* TGSI_OPCODE_ENDLOOP */ -/* TGSI_OPCODE_POW */ /* XXX: takes ABS */ -/* TGSI_OPCODE_CRS */ -/* TGSI_OPCODE_SGN */ -/* TGSI_OPCODE_ABS */ -/* TGSI_OPCODE_NRM4 */ -/* TGSI_OPCODE_SINCOS */ -/* TGSI_OPCODE_REP */ -/* TGSI_OPCODE_ENDREP */ -/* TGSI_OPCODE_IF */ -/* TGSI_OPCODE_IFC */ -/* TGSI_OPCODE_ELSE */ -/* TGSI_OPCODE_ENDIF */ -/* TGSI_OPCODE_BREAK */ -/* TGSI_OPCODE_BREAKC */ -/* TGSI_OPCODE_MOVA */ -/* TGSI_OPCODE_LOGP */ #define TGSI_OPCODE_KIL 132 /* unpredicated kill */ #define TGSI_OPCODE_END 133 /* aka HALT */ diff --git a/src/mesa/pipe/softpipe/sp_headers.h b/src/mesa/pipe/softpipe/sp_headers.h index e23742f803..b9f2b2205a 100644 --- a/src/mesa/pipe/softpipe/sp_headers.h +++ b/src/mesa/pipe/softpipe/sp_headers.h @@ -31,7 +31,7 @@ #ifndef SP_HEADERS_H #define SP_HEADERS_H -#include "../tgsi/exec/tgsi_core.h" +#include "pipe/tgsi/exec/tgsi_exec.h" #define PRIM_POINT 1 #define PRIM_LINE 2 diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/mesa/pipe/softpipe/sp_quad.c index 5a0df6de9d..e0327c4cf9 100644 --- a/src/mesa/pipe/softpipe/sp_quad.c +++ b/src/mesa/pipe/softpipe/sp_quad.c @@ -27,9 +27,8 @@ #include "sp_context.h" - #include "sp_state.h" -#include "pipe/tgsi/exec/tgsi_token.h" +#include "pipe/p_shader_tokens.h" static void sp_push_quad_first( diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index ed14dac18e..24c8a44c47 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -37,6 +37,7 @@ #include "pipe/p_util.h" #include "pipe/p_defines.h" +#include "pipe/p_shader_tokens.h" #include "x86/rtasm/x86sse.h" diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 81f70f0f24..c4f1a0a01a 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -26,15 +26,12 @@ **************************************************************************/ #include "pipe/p_util.h" - +#include "pipe/p_shader_tokens.h" #include "pipe/draw/draw_context.h" #include "pipe/draw/draw_vertex.h" - #include "sp_context.h" #include "sp_state.h" -#include "pipe/tgsi/exec/tgsi_token.h" - /** * Determine which post-transform / pre-rasterization vertex attributes @@ -156,10 +153,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) if (1/*vinfo->attr_mask != softpipe->attr_mask*/) { /*softpipe->attr_mask = vinfo->attr_mask;*/ - draw_set_vertex_attributes( softpipe->draw, - NULL,/*vinfo->slot_to_attrib,*/ - vinfo->interp_mode, - vinfo->num_attribs); + draw_set_vertex_info( softpipe->draw, vinfo); draw_set_twoside_attributes(softpipe->draw, front0, back0, front1, back1); diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c index ba564b16e6..912f42d568 100644 --- a/src/mesa/pipe/softpipe/sp_state_fs.c +++ b/src/mesa/pipe/softpipe/sp_state_fs.c @@ -32,7 +32,7 @@ #include "pipe/p_util.h" #include "pipe/p_winsys.h" #include "pipe/draw/draw_context.h" -#include "pipe/tgsi/exec/tgsi_core.h" +#include "pipe/p_shader_tokens.h" #include "pipe/llvm/gallivm.h" diff --git a/src/mesa/pipe/tgsi/deco/Makefile b/src/mesa/pipe/tgsi/deco/Makefile deleted file mode 100644 index eb8b14e0e8..0000000000 --- a/src/mesa/pipe/tgsi/deco/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -default: - cd ../../.. ; make - diff --git a/src/mesa/pipe/tgsi/deco/deco_caps.c b/src/mesa/pipe/tgsi/deco/deco_caps.c deleted file mode 100644 index 66df05a14b..0000000000 --- a/src/mesa/pipe/tgsi/deco/deco_caps.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "tgsi_platform.h" -#include "tgsi_deco.h" - -void -tgsi_deco_caps_init( - struct tgsi_deco_caps *caps ) -{ - memset( caps, 0, sizeof( *caps ) ); -} - diff --git a/src/mesa/pipe/tgsi/deco/deco_caps.h b/src/mesa/pipe/tgsi/deco/deco_caps.h deleted file mode 100644 index 40ca1c96f3..0000000000 --- a/src/mesa/pipe/tgsi/deco/deco_caps.h +++ /dev/null @@ -1,112 +0,0 @@ -#if !defined DECO_CAPS_H -#define DECO_CAPS_H - -#if defined __cplusplus -extern "C" { -#endif // defined __cplusplus - -struct tgsi_deco_caps -{ - /* - * Predicates (D3D9-specific). - * - * Constraints: - * 1. Token tgsi_dst_register_ext_predicate must not be used. - * 2. Token tgsi_instruction_ext_predicate must not be used. - */ - unsigned Predicates : 1; - - /* - * Destination register post-modulate. - * - * Constraints: - * 1. Field tgsi_dst_register_ext_modulate::Modulate - * must be set to TGSI_MODULATE_1X. - */ - unsigned DstModulate : 1; - - /* - * Condition codes (NVIDIA-specific). - * - * Constraints: - * 1. Token tgsi_dst_register_ext_concode must not be used. - * 2. Field tgsi_instruction_ext_nv::CondDstUpdate must be set to FALSE. - * 3. Field tgsi_instruction_ext_nv::CondFlowEnable must be set to FALSE. - */ - unsigned ConCodes : 1; - - /* - * Source register invert. - * - * Constraints: - * 1. Field tgsi_src_register_ext_mod::Complement must be set to FALSE. - */ - unsigned SrcInvert : 1; - - /* - * Source register bias. - * - * Constraints: - * 1. Field tgsi_src_register_ext_mod::Bias must be set to FALSE. - */ - unsigned SrcBias : 1; - - /* - * Source register scale by 2. - * - * Constraints: - * 1. Field tgsi_src_register_ext_mod::Scale2X must be set to FALSE. - */ - unsigned SrcScale : 1; - - /* - * Source register absolute. - * - * Constraints: - * 1. Field tgsi_src_register_ext_mod::Absolute must be set to FALSE. - */ - unsigned SrcAbsolute : 1; - - /* - * Source register force sign. - * - * Constraints: - * 1. Fields tgsi_src_register_ext_mod::Absolute and - * tgsi_src_register_ext_mod::Negate must not be both set to TRUE - * at the same time. - */ - unsigned SrcForceSign : 1; - - /* - * Source register divide. - * - * Constraints: - * 1. Field tgsi_src_register_ext_swz::ExtDivide - * must be set to TGSI_EXTSWIZZLE_ONE. - */ - unsigned SrcDivide : 1; - - /* - * Source register extended swizzle. - * - * Constraints: - * 1. Field tgsi_src_register_ext_swz::ExtSwizzleX/Y/Z/W - * must be set to TGSI_EXTSWIZZLE_X/Y/Z/W. - * 2. Fields tgsi_src_register_ext_swz::NegateX/Y/Z/W - * must all be set to the same value. - */ - unsigned SrcExtSwizzle : 1; - - unsigned Padding : 22; -}; - -void -tgsi_deco_caps_init( - struct tgsi_deco_caps *caps ); - -#if defined __cplusplus -} // extern "C" -#endif // defined __cplusplus - -#endif // !defined DECO_CAPS_H - diff --git a/src/mesa/pipe/tgsi/deco/tgsi_deco.h b/src/mesa/pipe/tgsi/deco/tgsi_deco.h deleted file mode 100644 index 3560e455f3..0000000000 --- a/src/mesa/pipe/tgsi/deco/tgsi_deco.h +++ /dev/null @@ -1,8 +0,0 @@ -#if !defined TGSI_DECO_H -#define TGSI_DECO_H - -#include "../exec/tgsi_core.h" -#include "deco_caps.h" - -#endif // !defined TGSI_DECO_H - diff --git a/src/mesa/pipe/tgsi/exec/tgsi_core.h b/src/mesa/pipe/tgsi/exec/tgsi_core.h deleted file mode 100644 index 30ad801b6e..0000000000 --- a/src/mesa/pipe/tgsi/exec/tgsi_core.h +++ /dev/null @@ -1,13 +0,0 @@ -#if !defined TGSI_CORE_H -#define TGSI_CORE_H - -#include "tgsi_token.h" -#include "tgsi_parse.h" -#include "tgsi_build.h" -#include "tgsi_exec.h" -#include "tgsi_dump.h" -#include "tgsi_util.h" -#include "tgsi_sse2.h" - -#endif // !defined TGSI_CORE_H - diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index ea6c5021b3..dd11dd58b7 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -46,14 +46,17 @@ * * * Authors: - * Michael Krol + * Michal Krol * Brian Paul */ #include "pipe/p_compiler.h" #include "pipe/p_state.h" #include "pipe/p_util.h" -#include "tgsi_core.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/tgsi/util/tgsi_parse.h" +#include "pipe/tgsi/util/tgsi_util.h" +#include "tgsi_exec.h" #define TILE_TOP_LEFT 0 #define TILE_TOP_RIGHT 1 diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c index 3a5c1da180..e403cfaaf3 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c @@ -25,8 +25,13 @@ * **************************************************************************/ -#include "tgsi_platform.h" -#include "tgsi_core.h" +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/tgsi/util/tgsi_parse.h" +#include "pipe/tgsi/util/tgsi_util.h" +#include "tgsi_exec.h" +#include "tgsi_sse2.h" + #include "x86/rtasm/x86sse.h" #if defined(__i386__) || defined(__386__) diff --git a/src/mesa/pipe/tgsi/tgsi_platform.h b/src/mesa/pipe/tgsi/tgsi_platform.h deleted file mode 100644 index b98a1f21be..0000000000 --- a/src/mesa/pipe/tgsi/tgsi_platform.h +++ /dev/null @@ -1,19 +0,0 @@ -#if !defined TGSI_PLATFORM_H -#define TGSI_PLATFORM_H - -#if defined __cplusplus -extern "C" { -#endif // defined __cplusplus - -#include "imports.h" -#include "mtypes.h" -#include "prog_instruction.h" -#include "program.h" -#include "pipe/p_compiler.h" - -#if defined __cplusplus -} // extern "C" -#endif // defined __cplusplus - -#endif // !defined TGSI_PLATFORM_H - diff --git a/src/mesa/pipe/tgsi/exec/tgsi_build.c b/src/mesa/pipe/tgsi/util/tgsi_build.c index 78f648aae2..19b2aad921 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_build.c +++ b/src/mesa/pipe/tgsi/util/tgsi_build.c @@ -1,5 +1,7 @@ -#include "tgsi_platform.h" -#include "tgsi_core.h" +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" +#include "tgsi_build.h" +#include "tgsi_parse.h" /* * version diff --git a/src/mesa/pipe/tgsi/exec/tgsi_build.h b/src/mesa/pipe/tgsi/util/tgsi_build.h index 116c78abf3..116c78abf3 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_build.h +++ b/src/mesa/pipe/tgsi/util/tgsi_build.h diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/util/tgsi_dump.c index 1df71efff7..982d5ce796 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_dump.c +++ b/src/mesa/pipe/tgsi/util/tgsi_dump.c @@ -25,8 +25,11 @@ * **************************************************************************/ -#include "tgsi_platform.h" -#include "tgsi_core.h" +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" +#include "tgsi_dump.h" +#include "tgsi_parse.h" +#include "tgsi_build.h" struct text_dump { diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.h b/src/mesa/pipe/tgsi/util/tgsi_dump.h index 70860c0885..70860c0885 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_dump.h +++ b/src/mesa/pipe/tgsi/util/tgsi_dump.h diff --git a/src/mesa/pipe/tgsi/exec/tgsi_parse.c b/src/mesa/pipe/tgsi/util/tgsi_parse.c index aee71decb3..f0f8d44ac2 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_parse.c +++ b/src/mesa/pipe/tgsi/util/tgsi_parse.c @@ -25,8 +25,10 @@ * **************************************************************************/ -#include "tgsi_platform.h" -#include "tgsi_core.h" +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" +#include "tgsi_parse.h" +#include "tgsi_build.h" void tgsi_full_token_init( diff --git a/src/mesa/pipe/tgsi/exec/tgsi_parse.h b/src/mesa/pipe/tgsi/util/tgsi_parse.h index 9372da8d5d..9372da8d5d 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_parse.h +++ b/src/mesa/pipe/tgsi/util/tgsi_parse.h diff --git a/src/mesa/pipe/tgsi/exec/tgsi_util.c b/src/mesa/pipe/tgsi/util/tgsi_util.c index d1bc935526..1e76b0f133 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_util.c +++ b/src/mesa/pipe/tgsi/util/tgsi_util.c @@ -1,5 +1,8 @@ -#include "tgsi_platform.h" -#include "tgsi_core.h" +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" +#include "tgsi_parse.h" +#include "tgsi_build.h" +#include "tgsi_util.h" union pointer_hack { diff --git a/src/mesa/pipe/tgsi/exec/tgsi_util.h b/src/mesa/pipe/tgsi/util/tgsi_util.h index ef14446f0e..ef14446f0e 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_util.h +++ b/src/mesa/pipe/tgsi/util/tgsi_util.h diff --git a/src/mesa/sources b/src/mesa/sources index 0b9b5fca3a..2df60d1996 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -169,6 +169,7 @@ DRAW_SOURCES = \ pipe/draw/draw_twoside.c \ pipe/draw/draw_unfilled.c \ pipe/draw/draw_validate.c \ + pipe/draw/draw_vbuf.c \ pipe/draw/draw_vertex.c \ pipe/draw/draw_vertex_cache.c \ pipe/draw/draw_vertex_fetch.c \ @@ -177,15 +178,14 @@ DRAW_SOURCES = \ pipe/draw/draw_wide_prims.c TGSIEXEC_SOURCES = \ - pipe/tgsi/exec/tgsi_build.c \ - pipe/tgsi/exec/tgsi_dump.c \ pipe/tgsi/exec/tgsi_exec.c \ - pipe/tgsi/exec/tgsi_parse.c \ - pipe/tgsi/exec/tgsi_sse2.c \ - pipe/tgsi/exec/tgsi_util.c + pipe/tgsi/exec/tgsi_sse2.c -TGSIDECO_SOURCES = \ - pipe/tgsi/deco/deco_caps.c +TGSIUTIL_SOURCES = \ + pipe/tgsi/util/tgsi_build.c \ + pipe/tgsi/util/tgsi_dump.c \ + pipe/tgsi/util/tgsi_parse.c \ + pipe/tgsi/util/tgsi_util.c LLVMTGSI_SOURCES = \ @@ -384,7 +384,7 @@ SOLO_SOURCES = \ $(VF_SOURCES) \ $(DRAW_SOURCES) \ $(TGSIEXEC_SOURCES) \ - $(TGSIDECO_SOURCES) \ + $(TGSIUTIL_SOURCES) \ $(STATECACHE_SOURCES) \ $(STATETRACKER_SOURCES) \ $(TNL_SOURCES) \ diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index d4976941f9..4ec10badad 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -41,7 +41,7 @@ #include "main/mtypes.h" #include "pipe/p_context.h" -#include "pipe/tgsi/exec/tgsi_core.h" +#include "pipe/p_shader_tokens.h" #include "st_context.h" #include "st_cache.h" diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c index e00684ac03..cffd66751d 100644 --- a/src/mesa/state_tracker/st_debug.c +++ b/src/mesa/state_tracker/st_debug.c @@ -30,7 +30,8 @@ #include "shader/prog_print.h" #include "pipe/p_state.h" -#include "pipe/tgsi/exec/tgsi_core.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/tgsi/util/tgsi_dump.h" #include "pipe/cso_cache/cso_cache.h" diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 3b6d829145..61ff034550 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -324,27 +324,26 @@ static void set_feedback_vertex_format(GLcontext *ctx) { struct st_context *st = ctx->st; - uint attrs[PIPE_MAX_SHADER_OUTPUTS]; - enum interp_mode interp[PIPE_MAX_SHADER_OUTPUTS]; - GLuint n, i; + struct vertex_info vinfo; + GLuint i; if (ctx->RenderMode == GL_SELECT) { assert(ctx->RenderMode == GL_SELECT); - n = 1; - attrs[0] = FORMAT_4F; - interp[0] = INTERP_NONE; + vinfo.num_attribs = 1; + vinfo.format[0] = FORMAT_4F; + vinfo.interp_mode[0] = INTERP_NONE; } else { /* GL_FEEDBACK, or glRasterPos */ /* emit all attribs (pos, color, texcoord) as GLfloat[4] */ - n = st->state.vs->state.num_outputs; - for (i = 0; i < n; i++) { - attrs[i] = FORMAT_4F; - interp[i] = INTERP_NONE; + vinfo.num_attribs = st->state.vs->state.num_outputs; + for (i = 0; i < vinfo.num_attribs; i++) { + vinfo.format[i] = FORMAT_4F; + vinfo.interp_mode[i] = INTERP_LINEAR; } } - draw_set_vertex_attributes(st->draw, attrs, interp, n); + draw_set_vertex_info(st->draw, &vinfo); } diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index c6b5bc968f..6d056dbe83 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -109,12 +109,14 @@ st_get_format_info( info = format; #if 0 - printf( - "PIPE_FORMAT: X(%u), Y(%u), Z(%u), W(%u)\n", - info.sizeX, - info.sizeY, - info.sizeZ, - info.sizeW ); + { + char fmtname[256]; + + pf_sprint_name( fmtname, format ); + printf( + "%s\n", + fmtname ); + } #endif /* Data type */ diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index ab7aa504a1..b392edf16d 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -30,10 +30,13 @@ * Michal Krol */ - -#include "tgsi_platform.h" -#include "pipe/tgsi/exec/tgsi_core.h" +#include "pipe/p_compiler.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/tgsi/util/tgsi_parse.h" +#include "pipe/tgsi/util/tgsi_build.h" +#include "pipe/tgsi/util/tgsi_util.h" #include "st_mesa_to_tgsi.h" +#include "shader/prog_instruction.h" #include "shader/prog_parameter.h" #define TGSI_DEBUG 0 diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 941a75ab05..4cd4b96a58 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -29,11 +29,15 @@ #ifndef ST_MESA_TO_TGSI_H
#define ST_MESA_TO_TGSI_H
+#include "mtypes.h"
+
+
#if defined __cplusplus
extern "C" {
#endif
struct tgsi_token;
+struct gl_program;
GLboolean
tgsi_translate_mesa_program(
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index ce5384671c..4e8bdc820e 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -36,8 +36,8 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" +#include "pipe/p_shader_tokens.h" #include "pipe/draw/draw_context.h" -#include "pipe/tgsi/exec/tgsi_core.h" #include "st_context.h" #include "st_cache.h" diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 51877af8da..049f9f659f 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -35,7 +35,7 @@ #define ST_PROGRAM_H #include "mtypes.h" -#include "pipe/tgsi/exec/tgsi_token.h" +#include "pipe/p_shader_tokens.h" #include "x86/rtasm/x86sse.h" |