* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
* 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
* 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
* 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:
* 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 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.
* 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.
* 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.
* 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.
* The responsibilities of a middle end are to:
* - perform vertex fetch using
* - draw vertex element/buffer state
* - a list of fetch indices we received as an input
* - run the vertex shader
* The responsibilities of a middle end are to:
* - perform vertex fetch using
* - draw vertex element/buffer state
* - a list of fetch indices we received as an input
* - run the vertex shader
* - viewport transformation
* - if necessary, run the primitive pipeline, passing it:
* - a linear array of vertex_header vertices constructed here
* - viewport transformation
* - if necessary, run the primitive pipeline, passing it:
* - a linear array of vertex_header vertices constructed here
struct fetch_emit_middle_end {
struct draw_pt_middle_end base;
struct draw_context *draw;
struct fetch_emit_middle_end {
struct draw_pt_middle_end base;
struct draw_context *draw;
/* Must do this after set_primitive() above:
*/
vinfo = feme->vinfo = draw->render->get_vertex_info(draw->render);
/* Must do this after set_primitive() above:
*/
vinfo = feme->vinfo = draw->render->get_vertex_info(draw->render);
/* Transform from API vertices to HW vertices, skipping the
* pipeline_vertex intermediate step.
/* Transform from API vertices to HW vertices, skipping the
* pipeline_vertex intermediate step.
key.element[i].instance_divisor = src->instance_divisor;
key.element[i].output_format = output_format;
key.element[i].output_offset = dst_offset;
key.element[i].instance_divisor = src->instance_divisor;
key.element[i].output_format = output_format;
key.element[i].output_offset = dst_offset;
{
translate_key_sanitize(&key);
feme->translate = translate_cache_find(feme->cache,
&key);
{
translate_key_sanitize(&key);
feme->translate = translate_cache_find(feme->cache,
&key);
-
- feme->translate->set_buffer(feme->translate,
- draw->pt.nr_vertex_buffers,
+ feme->translate->set_buffer(feme->translate,
+ draw->pt.nr_vertex_buffers,
- feme->translate->set_buffer(feme->translate,
- i,
- ((char *)draw->pt.user.vbuffer[i] +
+ feme->translate->set_buffer(feme->translate,
+ i,
+ ((char *)draw->pt.user.vbuffer[i].map +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
static void fetch_emit_run( struct draw_pt_middle_end *middle,
const unsigned *fetch_elts,
unsigned fetch_count,
static void fetch_emit_run( struct draw_pt_middle_end *middle,
const unsigned *fetch_elts,
unsigned fetch_count,
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
void *hw_verts;
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
struct draw_context *draw = feme->draw;
void *hw_verts;
unsigned i;
for (i = 0; i < fetch_count; i++) {
debug_printf("\n\nvertex %d:\n", i);
unsigned i;
for (i = 0; i < fetch_count; i++) {
debug_printf("\n\nvertex %d:\n", i);
if (!draw->render->allocate_vertices( draw->render,
(ushort)feme->translate->key.output_stride,
if (!draw->render->allocate_vertices( draw->render,
(ushort)feme->translate->key.output_stride,
static void fetch_emit_destroy( struct draw_pt_middle_end *middle )
{
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;
static void fetch_emit_destroy( struct draw_pt_middle_end *middle )
{
struct fetch_emit_middle_end *feme = (struct fetch_emit_middle_end *)middle;